{"record":{"id":"451952ceefdf40ac","repo":"apple/pkl","slug":"string","errorCode":null,"errorMessage":"string","messagePattern":"string","errorType":"exception","errorClass":"FormatException","httpStatus":null,"severity":"error","filePath":"pkl-core/src/main/java/org/pkl/core/ImportGraph.java","lineNumber":101,"sourceCode":"      }\n    }\n    return ret;\n  }\n\n  private static ImportGraph.Import parseImport(Json.JsObject jsObject) throws JsonParseException {\n    var uri = jsObject.getURI(\"uri\");\n    return new Import(uri);\n  }\n\n  private static Map<URI, URI> parseResolvedImports(Json.JsObject jsObject)\n      throws JsonParseException {\n    var ret = new TreeMap<URI, URI>();\n    for (var entry : jsObject.entrySet()) {\n      try {\n        var key = new URI(entry.getKey());\n        var value = entry.getValue();\n        if (!(value instanceof String str)) {\n          throw new FormatException(\"string\", value == null ? Void.class : value.getClass());\n        }\n        var valueUri = new URI(str);\n        ret.put(key, valueUri);\n      } catch (URISyntaxException e) {\n        throw new MappingException(entry.getKey(), e);\n      }\n    }\n    return ret;\n  }\n}\n","sourceCodeStart":83,"sourceCodeEnd":112,"githubUrl":"https://github.com/apple/pkl/blob/f3efcbfc9b60d30053b0536d664948d7aa1b8673/pkl-core/src/main/java/org/pkl/core/ImportGraph.java#L83-L112","documentation":"Thrown by ImportGraph.parseResolvedImports when a value in the resolved-imports map is not a JSON string. Each key/value pair must be URI strings mapping an import URI to its resolved URI; this FormatException signals a non-string (or null) value.","triggerScenarios":"Calling resolvedImports() on a graph whose resolvedImports JSON map contains a value that is a number, object, boolean, or null instead of a URI string.","commonSituations":"Corrupted or hand-edited resolution cache files, schema drift between Pkl versions, or a third-party tool writing resolved import maps in the wrong shape.","solutions":["Fix the offending value in the resolved imports JSON to be a URI string","Delete/regenerate the resolved-imports cache file","Verify all tools reading/writing the map use the string-to-string URI map schema"],"exampleFix":"// before: {\"file:///a.pkl\": 42}\n// after:  {\"file:///a.pkl\": \"file:///resolved/a.pkl\"}","handlingStrategy":"validation","validationCode":"for (var e : resolvedJson.entrySet()) {\n  if (e.getValue() == null || !(e.getValue() instanceof String)) {\n    throw new IllegalArgumentException(\"resolved import value for \" + e.getKey() + \" must be a URI string\");\n  }\n}","typeGuard":"if (!(value instanceof String str)) throw new FormatException(\"string\", value.getClass());","tryCatchPattern":"try {\n  graph.resolvedImports();\n} catch (FormatException e) {\n  LOG.error(\"Invalid resolved imports map: {}\", e.getMessage());\n  // fall back to regenerating the graph\n}","preventionTips":["Keep resolved-import maps strictly string-to-string URI mappings","Clear resolution caches when upgrading Pkl versions","Validate JSON before feeding it to ImportGraph"],"tags":["java","pkl","deserialization","format"],"backgroundTag":"invalid-argument-format","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"}