{"record":{"id":"c464e6f895918c15","repo":"apple/pkl","slug":"missinglocalpropertyvalue","errorCode":"missingLocalPropertyValue","errorMessage":"missingLocalPropertyValue","messagePattern":"missingLocalPropertyValue","errorType":"error_code","errorClass":"VmException","httpStatus":null,"severity":"error","filePath":"pkl-core/src/main/java/org/pkl/core/ast/builder/AstBuilder.java","lineNumber":2093,"sourceCode":"            bodyNode = visitExpr(expr);\n          } else if (!objectBodies.isEmpty()) { // prop { ... }\n            if (typeAnnotation != null) {\n              throw exceptionBuilder()\n                  .evalError(\"cannotAmendPropertyDefinition\")\n                  .withSourceSection(createSourceSection(entry))\n                  .build();\n            }\n            bodyNode =\n                doVisitObjectBody(\n                    objectBodies,\n                    new ReadSuperPropertyNode(\n                        unavailableSourceSection(),\n                        scope.getName(),\n                        scope.getConstLevel() == ConstLevel.ALL));\n          } else { // no value given\n            if (isLocal) {\n              assert typeAnnotation != null;\n              throw missingLocalPropertyValue(typeAnnotation);\n            }\n            if (VmModifier.isExternal(modifiers)) {\n              bodyNode =\n                  externalMemberRegistry.getPropertyBody(scope.getQualifiedName(), headerSection);\n              if (bodyNode instanceof LanguageAwareNode languageAwareNode) {\n                languageAwareNode.initLanguage(language);\n              }\n            } else {\n              bodyNode = null; // will be given a default by UnresolvedPropertyNode\n            }\n          }\n\n          var typeAnnNode = visitTypeAnnotation(typeAnnotation);\n\n          return new UnresolvedPropertyNode(\n              language,\n              sourceSection,\n              headerSection,","sourceCodeStart":2075,"sourceCodeEnd":2111,"githubUrl":"https://github.com/apple/pkl/blob/f3efcbfc9b60d30053b0536d664948d7aa1b8673/pkl-core/src/main/java/org/pkl/core/ast/builder/AstBuilder.java#L2075-L2111","documentation":"A `local` property must have a value — locals exist only within the enclosing scope and cannot be external or deferred. When a local property has no body/expression, AstBuilder calls missingLocalPropertyValue(typeAnnotation) (asserting a type annotation exists), producing an error anchored to the type annotation.","triggerScenarios":"Declaring `local prop: Type` (or `local const prop: Type`) with no `= expr` and no object body — isLocal is true and the no-value branch is taken.","commonSituations":"Declaring a local constant/placeholder intending to fill it in later; converting a module property (which may be external) to a local without adding a value.","solutions":["Add a value: `local prop: Type = expr`.","Remove the `local` modifier if it should be an external or overridable module property.","Remove the declaration entirely if unused."],"exampleFix":"// before\nlocal timeout: Duration\n\n// after\nlocal timeout: Duration = 30.s","handlingStrategy":"validation","validationCode":"// Every local declaration must have an initializer:\nif (isLocalDecl(decl) && decl.getInitializer() == null) {\n  report(decl, \"local properties require a value\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never leave `local` declarations without `= expr`.","If you need a placeholder that is filled later, use a normal (non-local) property with a default.","Review refactors that change module properties into locals."],"tags":["pkl","ast","local","property"],"backgroundTag":"missing-required-config-field","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"}