Skip to content

foamDictionary wrongly shows available parent dicts in error messages instead of sub-dict alternatives

Description

When trying to -set the value of a sub-dict castellatedMeshControls/.../<sub>/, with a non-existing sub-dict sub (e.g. due to typo in sub-dict name), the error message should present alternatives to <sub>. Instead, it shows known entries for the parent dict.

Example

Faulty call - lacking motorBike between refinementSurfaces and regions:

foamDictionary "system/snappyHexMeshDict" \
          -entry "castellatedMeshControls/refinementSurfaces/regions/$surfaceRegionName" \
          -set "{ level (  $l1 $l2 ); }"

Yields:

--> FOAM FATAL IO ERROR: (openfoam-2412)
'castellatedMeshControls/refinementSurfaces/regions' not found in dictionary "system/snappyHexMeshDict" or is not a dictionary
Known entries are 
15
(
FoamFile
castellatedMesh
snap
addLayers
mergePatchFaces
mergeAcrossPatches
nLayersDefault
geometry
castellatedMeshControls
snapControls
addLayersControls
meshQualityControls
writeFlags
mergeTolerance
addSingleLayers
)

Instead, it should list entries inside refinementSurfaces - as indicated in the error message itself.