{"record":{"id":"34c0b1ba1482c11d","repo":"apple/pkl","slug":"invalidprojectdepsjson","errorCode":"invalidProjectDepsJson","errorMessage":"invalidProjectDepsJson","messagePattern":"invalidProjectDepsJson","errorType":"error_code","errorClass":"VmException","httpStatus":null,"severity":"error","filePath":"pkl-core/src/main/java/org/pkl/core/module/ProjectDependenciesManager.java","lineNumber":260,"sourceCode":"  }\n\n  private ProjectDeps getProjectDeps() {\n    synchronized (lock) {\n      if (projectDeps == null) {\n        var depsUri = getProjectDepsFileUri();\n        var moduleKey = moduleResolver.resolve(depsUri);\n        try {\n          // treat PklProject.deps.json as a module read, rather than introduce a new API.\n          var depsJson = moduleKey.resolve(securityManager).loadSource();\n          projectDeps = ProjectDeps.parse(depsJson);\n        } catch (IOException e) {\n          throw new VmExceptionBuilder()\n              .evalError(\"cannotLoadProjectDepsJson\", depsUri)\n              .withCause(e)\n              .withHint(e.getMessage() != null ? e.getMessage() : (\"Encountered error: \" + e))\n              .build();\n        } catch (JsonParseException e) {\n          throw new VmExceptionBuilder()\n              .evalError(\"invalidProjectDepsJson\", depsUri, e.getMessage())\n              .build();\n        } catch (SecurityManagerException e) {\n          throw PklBugException.unreachableCode();\n        }\n      }\n      return projectDeps;\n    }\n  }\n}\n","sourceCodeStart":242,"sourceCodeEnd":271,"githubUrl":"https://github.com/apple/pkl/blob/f3efcbfc9b60d30053b0536d664948d7aa1b8673/pkl-core/src/main/java/org/pkl/core/module/ProjectDependenciesManager.java#L242-L271","documentation":"invalidProjectDepsJson is thrown by ProjectDependenciesManager.getProjectDeps when PklProject.deps.json was successfully read but failed JSON parsing (JsonParseException). The parse error message is included in the error so developers can locate the malformed spot. A SecurityManagerException at this point is treated as unreachable, so this error is purely about malformed JSON content.","triggerScenarios":"Calling projectDeps, resolvedDep, or dep when the contents of PklProject.deps.json are not valid JSON — hand-edited lockfile, truncated download, merge-conflict markers left in the file, or BOM/encoding corruption.","commonSituations":"Developers hand-editing PklProject.deps.json and introducing a trailing comma or unquoted key; git merge conflicts resolved poorly; interrupted `pkl project resolve` leaving a partial file; copying deps.json through a tool that mangles encoding.","solutions":["Fix the JSON syntax at the location given in the error message (trailing commas, unquoted keys, stray text).","Regenerate the file with `pkl project resolve` instead of hand-editing it.","Check for unresolved git merge-conflict markers (<<<<<<< ======= >>>>>>>) in PklProject.deps.json.","Restore the file from source control if it was truncated or corrupted."],"exampleFix":"// before (PklProject.deps.json, hand-edited)\n{\"schemaVersion\": 1, \"dependencies\": {\"foo\": {\"uri\": \"package://...\",},},}\n// after: regenerate\n$ pkl project resolve","handlingStrategy":"validation","validationCode":"// Validate deps JSON before invoking pkl APIs\nvar mapper = new com.fasterxml.jackson.databind.ObjectMapper();\ntry { mapper.readTree(new File(projectDir, \"PklProject.deps.json\")); }\ncatch (IOException e) { throw new IllegalStateException(\"PklProject.deps.json is not valid JSON: \" + e.getMessage()); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat PklProject.deps.json as generated: regenerate with `pkl project resolve` instead of editing.","Run a JSON linter on the file after any manual edit.","Ensure git merges are fully resolved (no conflict markers) before evaluating.","Verify file integrity after downloads/interrupted writes."],"tags":["json","lockfile","project-deps","pkl"],"backgroundTag":"json-parse-error","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"}