apple/pkl · error

missingFixedModifier

missingFixedModifier

Error message

missingFixedModifier

What it means

Pkl throws missingFixedModifier when an overriding property is fixed in the superclass but the override omits the `fixed` modifier. UnresolvedPropertyNode.checkOverride enforces modifier consistency between a property and its overridden superclass property: a `fixed` supertype property cannot be re-declared without `fixed`, since allowing that would let subclasses un-fix a value. The error names the property, the superclass's qualified name, and the offending source text.

Source

Thrown at pkl-core/src/main/java/org/pkl/core/ast/member/UnresolvedPropertyNode.java:101

    return VmModifier.isImport(modifiers);
  }

  private void checkOverride(VmClass clazz) {
    var superClass = clazz.getSuperclass();
    if (superClass == null) {
      return;
    }
    var superProperty = superClass.getProperty(name);
    if (superProperty == null) {
      return;
    }
    var isFixed = VmModifier.isFixed(modifiers);
    if (superProperty.isFixed() == isFixed) {
      return;
    }
    CompilerDirectives.transferToInterpreter();
    if (superProperty.isFixed()) {
      throw exceptionBuilder()
          .withSourceSection(headerSection)
          .evalError(
              "missingFixedModifier",
              name,
              superClass.getQualifiedName(),
              sourceSection.getCharacters())
          .build();
    }
    var source = headerSection.getCharacters().toString();
    var fixedModifierIdx = source.indexOf("fixed");
    throw exceptionBuilder()
        .withSourceSection(
            headerSection
                .getSource()
                .createSection(headerSection.getCharIndex() + fixedModifierIdx, 5))
        .evalError("cannotApplyFixedModifier", name, superClass.getQualifiedName())
        .build();
  }

View on GitHub (pinned to f3efcbfc9b)

Solutions

  1. Add the `fixed` modifier to the overriding property declaration.
  2. Alternatively, remove the override entirely and rely on the superclass's fixed value.
  3. Check the superclass's declared modifiers and mirror them exactly on the override.
  4. If the base recently became fixed, update all subclasses during the upgrade.

Example fix

// before
class Server extends Base {
  name: String = "mine"  // Base.name is fixed
}

// after
class Server extends Base {
  fixed name: String = "mine"
}
Defensive patterns

Strategy: validation

Validate before calling

// Before overriding a property, check the superclass declaration's modifiers:
// Base declares: `fixed name: String` -> your override must also say `fixed`.

Prevention

When it happens

Trigger: Overriding a `fixed` property from a base class/module without writing `fixed` on the override; base class updated to make a property `fixed` while subclasses still override without the modifier; generated subclasses not carrying modifiers from the base.

Common situations: Library upgrade makes a property fixed, breaking downstream extends; copying an override from a non-fixed sibling property; hand-writing overrides and forgetting modifier parity.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


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