{"record":{"id":"e22dbec2ceba3e09","repo":"Budibase/budibase","slug":"project-package-docs-do-not-match-dependency-index","errorCode":null,"errorMessage":"Project package docs do not match dependency-index.json.","messagePattern":"Project package docs do not match dependency-index\\.json\\.","errorType":"validation","errorClass":"HTTPError","httpStatus":400,"severity":"error","filePath":"packages/server/src/sdk/workspace/projects/backups/imports.ts","lineNumber":749,"sourceCode":"  docs: ImportedDoc[],\n  manifest: ProjectPackageManifest\n) => {\n  if (dependencyIndex.rootProjectId !== project._id) {\n    throw new HTTPError(\n      \"Project package dependency index does not match project.json.\",\n      400\n    )\n  }\n\n  const actualDocIds = new Set(docs.map(doc => doc.doc._id!))\n  const expectedDocIds = new Set(\n    Object.keys(dependencyIndex.resources).filter(\n      id => id !== dependencyIndex.rootProjectId\n    )\n  )\n\n  if (!dependencyIndex.resources[dependencyIndex.rootProjectId]) {\n    throw new HTTPError(\n      \"Project package docs do not match dependency-index.json.\",\n      400\n    )\n  }\n\n  for (const doc of docs) {\n    validateDocMatchesPath(doc)\n    if (!expectedDocIds.has(doc.doc._id!)) {\n      throw new HTTPError(\n        \"Project package contains docs not listed in dependency-index.json.\",\n        400\n      )\n    }\n  }\n\n  for (const expectedDocId of expectedDocIds) {\n    if (!actualDocIds.has(expectedDocId)) {\n      throw new HTTPError(","sourceCodeStart":731,"sourceCodeEnd":767,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/sdk/workspace/projects/backups/imports.ts#L731-L767","documentation":"The dependency index must contain an entry for the root project itself in its resources map (imports.ts:748-753). If dependencyIndex.resources[rootProjectId] is absent, the package's docs cannot be reconciled with the index, so import fails with 400. The same message is reused later at imports.ts:801 for directMembers whose docs are missing.","triggerScenarios":"Importing a package whose dependency-index.json resources map omits the key equal to rootProjectId — the root project entry was deleted, the index was generated only from members, or rootProjectId was renamed without updating resources.","commonSituations":"Hand-built dependency indexes listing only child resources; scripts that strip the project doc; renaming the project id in project.json without adding the new id as a key in resources.","solutions":["Add a resources entry keyed by rootProjectId with the root project's dependencies list.","Regenerate the package with the official export so the root project is always included in resources.","Verify with `jq --arg r .rootProjectId '.resources | has($r)' dependency-index.json` — it must be true.","If the project id was changed, update both rootProjectId and the resources keys consistently."],"exampleFix":"// before\n\"resources\": { \"ta_1\": { \"dependencies\": [] } }\n// after (root project present)\n\"resources\": { \"app_abc\": { \"dependencies\": [{ \"id\": \"ta_1\", \"name\": \"Table\", \"type\": \"table\" }] }, \"ta_1\": { \"dependencies\": [] } }","handlingStrategy":"validation","validationCode":"if (!pkg.dependencyIndex.resources[pkg.dependencyIndex.rootProjectId]) {\n  throw new Error(\"dependency-index.json must contain a resources entry for the root project\")\n}","typeGuard":null,"tryCatchPattern":"try {\n  await importProjectPackage(file)\n} catch (e) {\n  if (e.status === 400 && e.message.includes(\"docs do not match dependency-index.json\")) {\n    // verify the root project entry exists in resources before retrying\n  } else throw e\n}","preventionTips":["Always include the root project itself as a key in resources","If renaming the project id, update rootProjectId and resources keys together","Run a pre-import check: resources must have the rootProjectId key","Prefer regenerating the index over hand-editing it"],"tags":["validation","project-import","consistency"],"backgroundTag":"package-manifest-mismatch","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}