Budibase/budibase · error · HTTPError
Project package dependency index does not match project.json
Error message
Project package dependency index does not match project.json.
What it means
validateDependencyIndex (imports.ts:734-739) requires the package to be internally consistent: dependency-index.json's rootProjectId must equal the _id of the project in project.json. If they differ, the index describes a different project than the package manifest claims, so import is rejected with 400.
Source
Thrown at packages/server/src/sdk/workspace/projects/backups/imports.ts:735
for (const resource of Object.values(dependencyIndex.resources)) {
if (
!isRecord(resource) ||
!Array.isArray(resource.dependencies) ||
!resource.dependencies.every(validateUsedResource)
) {
throw new HTTPError("Project package dependency index is invalid.", 400)
}
}
}
const validateDependencyIndex = (
project: Project,
dependencyIndex: ProjectPackageDependencyIndex,
docs: ImportedDoc[],
manifest: ProjectPackageManifest
) => {
if (dependencyIndex.rootProjectId !== project._id) {
throw new HTTPError(
"Project package dependency index does not match project.json.",
400
)
}
const actualDocIds = new Set(docs.map(doc => doc.doc._id!))
const expectedDocIds = new Set(
Object.keys(dependencyIndex.resources).filter(
id => id !== dependencyIndex.rootProjectId
)
)
if (!dependencyIndex.resources[dependencyIndex.rootProjectId]) {
throw new HTTPError(
"Project package docs do not match dependency-index.json.",
400
)
}View on GitHub (pinned to a81a902e9a)
Solutions
- Re-export the project so project.json and dependency-index.json are generated together and share the same rootProjectId/_id.
- If editing manually, update dependencyIndex.rootProjectId to match project.json's _id (and the resources key for the root project).
- Ensure the archive does not mix files from different exports; rebuild the package from the source environment.
- Compare both files' ids: `jq ."_id" project.json` and `jq .rootProjectId dependency-index.json` must be equal.
Example fix
// dependency-index.json before
{ "rootProjectId": "app_old", ... }
// after (match project.json _id)
{ "rootProjectId": "app_new", ... } Defensive patterns
Strategy: validation
Validate before calling
const pkg = await readPackage(files)
if (pkg.project._id !== pkg.dependencyIndex.rootProjectId) {
throw new Error("dependency-index rootProjectId must equal project.json _id before import")
} Try / catch
try {
await importProjectPackage(file)
} catch (e) {
if (e.status === 400 && e.message.includes("does not match project.json")) {
// reject/rebuild package: files come from different exports
} else throw e
} Prevention
- Never edit project.json's _id without regenerating dependency-index.json
- Build packages in one pass so all metadata files are written together
- Check equality of project.json _id and index rootProjectId as a pre-import lint
- Avoid mixing files between exported archives
When it happens
Trigger: Importing a package where project.json's _id does not match dependencyIndex.rootProjectId — e.g. project.json was edited/regenerated (new id assigned) while the old dependency-index.json was kept, or files from two different exports were mixed into one archive.
Common situations: Repackaging a project under a new id by editing project.json only; merging exports; copying a dependency-index.json between packages; partial re-exports where project.json was rewritten but the index was not.
Related errors
- Project package docs do not match dependency-index.json.
- Project package contains docs not listed in dependency-index
- Project package dependency index references missing docs.
- Project package resource count mismatch for '${resourceType}
- Project package dependency index is invalid.
AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29).
Data as JSON: /api/errors/4d0afc8c26c863e2.
Report an issue: GitHub.