apple/pkl · error · NoSuchChildException
Node `%s` of type `%s` does not have a property named `%s`.
Error message
Node `%s` of type `%s` does not have a property named `%s`. Available properties: %s
What it means
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.
Source
Thrown at pkl-config-java/src/main/java/org/pkl/config/java/CompositeConfig.java:39
class CompositeConfig extends AbstractConfig {
private final Composite composite;
CompositeConfig(String qualifiedName, ValueMapper mapper, Composite composite) {
super(qualifiedName, mapper);
this.composite = composite;
}
@Override
public Object getRawValue() {
return composite;
}
@Override
protected Object getRawChildValue(String propertyName) {
var result = composite.getPropertyOrNull(propertyName);
if (result != null) return result;
throw new NoSuchChildException(
String.format(
"Node `%s` of type `%s` does not have a property named `%s`. Available properties: %s",
getQualifiedName(),
composite.getClassInfo().getQualifiedName(),
propertyName,
composite.getProperties().keySet()),
propertyName);
}
}
View on GitHub (pinned to f3efcbfc9b)
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.
Example fix
// before
class ServerConfig extends CompositeConfig {
int getPort() { return (Integer) getChild("prot"); } // typo
}
// after
class ServerConfig extends CompositeConfig {
int getPort() { return (Integer) getChild("port"); }
} Defensive patterns
Strategy: validation
Validate before calling
// probe the composite before typed access
var props = composite.getProperties().keySet();
if (!props.contains(propertyName)) {
throw new IllegalArgumentException(
propertyName + " not in " + props + "; regenerate config classes?");
} Type guard
static boolean hasProperty(CompositeConfig node, String name) {
return node.getRawChildValueOrNull(name) != null;
} Try / catch
try {
return node.getChild("port");
} catch (NoSuchChildException e) {
log.warn("config node {} missing child: {}", e.getNodeName(), e.getPropertyName());
return DEFAULT_VALUE; // or rethrow after schema-version check
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Node `%s` of type `%s` does not have a key named `%s`. Avail
- Leaf node `%s` of type `%s` does not have a child named `%s`
- Did not find expected Java class `%s` on the classpath for P
- Cannot convert Pkl object to Java object.%nPkl type
- noPackageDefinedByProject
AI-assisted analysis of apple/pkl@f3efcbfc9b (2026-09-08).
Data as JSON: /api/errors/8501b9c48d6c2cea.
Report an issue: GitHub.