{"record":{"id":"0b01e0b87eef81ee","repo":"apple/pkl","slug":"value","errorCode":null,"errorMessage":"value","messagePattern":"value","errorType":"exception","errorClass":"MissingFieldException","httpStatus":null,"severity":"error","filePath":"pkl-core/src/main/java/org/pkl/core/packages/DependencyMetadata.java","lineNumber":246,"sourceCode":"          var className = classInfoObj.getString(\"class\");\n          var moduleUri = classInfoObj.getString(\"moduleUri\");\n          var props = jsObj.getObject(\"properties\");\n          var classInfo = PClassInfo.get(moduleName, className, new URI(moduleUri));\n          var properties = new HashMap<String, Object>();\n          for (var kv : props.entrySet()) {\n            properties.put(kv.getKey(), parsePObject(kv.getValue()));\n          }\n          return new PObject(classInfo, properties);\n        }\n        case \"Pattern\" -> {\n          var value = jsObj.getString(\"value\");\n          return Pattern.compile(value);\n        }\n        case \"DataSize\" -> {\n          var symbol = jsObj.getString(\"unit\");\n          var value = jsObj.get(\"value\");\n          if (value == null) {\n            throw new MissingFieldException(jsObj, \"value\");\n          }\n          var unit = DataSizeUnit.parse(symbol);\n          if (unit == null) {\n            throw new PklException(\"Invalid DataSize unit symbol: \" + symbol);\n          }\n          if (!(value instanceof Double num)) {\n            throw new FormatException(\"double\", value.getClass());\n          }\n          return new DataSize(num, unit);\n        }\n        case \"Duration\" -> {\n          var symbol = jsObj.getString(\"unit\");\n          var value = jsObj.get(\"value\");\n          if (value == null) {\n            throw new MissingFieldException(jsObj, \"value\");\n          }\n          var unit = DurationUnit.parse(symbol);\n          if (unit == null) {","sourceCodeStart":228,"sourceCodeEnd":264,"githubUrl":"https://github.com/apple/pkl/blob/f3efcbfc9b60d30053b0536d664948d7aa1b8673/pkl-core/src/main/java/org/pkl/core/packages/DependencyMetadata.java#L228-L264","documentation":"MissingFieldException(jsObj, \"value\") is thrown by DependencyMetadata.parsePObject when a DataSize-typed annotation/metadata value lacks the required `value` field. A DataSize value must supply both a `unit` symbol and a numeric `value`; the missing field makes the size unrepresentable. It indicates an incomplete nested value object in the metadata.","triggerScenarios":"Parsing metadata whose entry of type \"DataSize\" contains {\"unit\": \"mb\"} with no \"value\" key.","commonSituations":"Hand-writing annotation values and omitting the numeric component; custom generators emitting only the unit; partially truncated metadata objects.","solutions":["Add the numeric `value` field alongside `unit`, e.g. {\"type\": \"DataSize\", \"unit\": \"mb\", \"value\": 10.0}.","Regenerate the metadata with `pkl project package`.","Validate the metadata JSON against the expected nested-value shape before publishing.","Check for truncated writes if the field was expected to be present."],"exampleFix":"// before\n{\"type\": \"DataSize\", \"unit\": \"gb\"}\n// after\n{\"type\": \"DataSize\", \"unit\": \"gb\", \"value\": 2.0}","handlingStrategy":"validation","validationCode":"var entry = root.get(\"...\");\nif (entry.get(\"type\").asString().equals(\"DataSize\")) {\n  if (!entry.has(\"value\") || !entry.get(\"value\").isNumber())\n    throw new IllegalStateException(\"DataSize entry requires numeric 'value' and 'unit'\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always emit both `unit` and numeric `value` for DataSize metadata.","Schema-validate nested typed values before publishing.","Prefer `pkl project package` for serialization to guarantee completeness.","Check for truncation when files are written over slow links."],"tags":["json","package-metadata","missing-field","datasize","pkl"],"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"}