{"record":{"id":"8501b9c48d6c2cea","repo":"apple/pkl","slug":"node-s-of-type-s-does-not-have-a-property-na","errorCode":null,"errorMessage":"Node `%s` of type `%s` does not have a property named `%s`. Available properties: %s","messagePattern":"Node `(.+?)` of type `(.+?)` does not have a property named `(.+?)`\\. Available properties: (.+?)","errorType":"exception","errorClass":"NoSuchChildException","httpStatus":null,"severity":"error","filePath":"pkl-config-java/src/main/java/org/pkl/config/java/CompositeConfig.java","lineNumber":39,"sourceCode":"class CompositeConfig extends AbstractConfig {\n  private final Composite composite;\n\n  CompositeConfig(String qualifiedName, ValueMapper mapper, Composite composite) {\n    super(qualifiedName, mapper);\n    this.composite = composite;\n  }\n\n  @Override\n  public Object getRawValue() {\n    return composite;\n  }\n\n  @Override\n  protected Object getRawChildValue(String propertyName) {\n    var result = composite.getPropertyOrNull(propertyName);\n    if (result != null) return result;\n\n    throw new NoSuchChildException(\n        String.format(\n            \"Node `%s` of type `%s` does not have a property named `%s`. Available properties: %s\",\n            getQualifiedName(),\n            composite.getClassInfo().getQualifiedName(),\n            propertyName,\n            composite.getProperties().keySet()),\n        propertyName);\n  }\n}\n","sourceCodeStart":21,"sourceCodeEnd":49,"githubUrl":"https://github.com/apple/pkl/blob/f3efcbfc9b60d30053b0536d664948d7aa1b8673/pkl-config-java/src/main/java/org/pkl/config/java/CompositeConfig.java#L21-L49","documentation":"CompositeConfig represents a Pkl object node that has properties. When code asks this node for a child value via a property name that the underlying Pkl object does not define, the library throws NoSuchChildException with the node's qualified name, its type, the requested property, and the list of properties that do exist. It is a lookup failure on a config tree, thrown from getRawChildValue which backs the typed getters.","triggerScenarios":"Calling config.getChild/property accessors (e.g. Config.get(...) or generated member access routed through getRawChildValue) with a property name absent from the Pkl object — typically a typo, or code written against a different version of the .pkl schema.","commonSituations":"Renaming a property in the .pkl module without regenerating Java code; typos in string-based lookups like config.get(\"httpProt\"); consuming config produced by a newer/older schema version than the code expects.","solutions":["Check the 'Available properties' list in the message and correct the property name to one of them.","Regenerate the typed Java config classes from the current .pkl sources so names stay in sync.","Verify you are loading the intended version of the Pkl module (classpath/dependency resolution).","Use composite.getPropertyOrNull-style lookups or an optional getter when a property may legitimately be absent."],"exampleFix":"// before\nclass ServerConfig extends CompositeConfig {\n  int getPort() { return (Integer) getChild(\"prot\"); } // typo\n}\n// after\nclass ServerConfig extends CompositeConfig {\n  int getPort() { return (Integer) getChild(\"port\"); }\n}","handlingStrategy":"validation","validationCode":"// probe the composite before typed access\nvar props = composite.getProperties().keySet();\nif (!props.contains(propertyName)) {\n  throw new IllegalArgumentException(\n      propertyName + \" not in \" + props + \"; regenerate config classes?\");\n}","typeGuard":"static boolean hasProperty(CompositeConfig node, String name) {\n  return node.getRawChildValueOrNull(name) != null;\n}","tryCatchPattern":"try {\n  return node.getChild(\"port\");\n} catch (NoSuchChildException e) {\n  log.warn(\"config node {} missing child: {}\", e.getNodeName(), e.getPropertyName());\n  return DEFAULT_VALUE; // or rethrow after schema-version check\n}","preventionTips":["Regenerate typed Java config classes whenever .pkl modules change","Never access properties via raw strings in application code — use generated accessors","Keep the .pkl module version pinned to the version the Java code was generated from","Handle the 'Available properties' list as a schema-mismatch signal, not just a typo"],"tags":["config","pkl","lookup","missing-property","generated-code"],"backgroundTag":"missing-config-key","analyzedSha":"f3efcbfc9b60d30053b0536d664948d7aa1b8673","analyzedAt":"2026-09-08T13:10:45.570Z","contentChangedAt":"2026-09-08T13:10:45.570Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}