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

  1. Check the 'Available properties' list in the message and correct the property name to one of them.
  2. Regenerate the typed Java config classes from the current .pkl sources so names stay in sync.
  3. Verify you are loading the intended version of the Pkl module (classpath/dependency resolution).
  4. 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

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


AI-assisted analysis of apple/pkl@f3efcbfc9b (2026-09-08). Data as JSON: /api/errors/8501b9c48d6c2cea. Report an issue: GitHub.