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

  1. Re-export the project so project.json and dependency-index.json are generated together and share the same rootProjectId/_id.
  2. If editing manually, update dependencyIndex.rootProjectId to match project.json's _id (and the resources key for the root project).
  3. Ensure the archive does not mix files from different exports; rebuild the package from the source environment.
  4. 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

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


AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29). Data as JSON: /api/errors/4d0afc8c26c863e2. Report an issue: GitHub.