Budibase/budibase · error · HTTPError

Project package dependency index is invalid.

Error message

Project package dependency index is invalid.

What it means

During project package import, Budibase validates dependency-index.json before ingesting any documents. This error means the top-level shape of dependency-index.json failed structural validation: it is not an object, or rootProjectId is not a string, or directMembers is not an array of valid used-resource entries ({id, name, type} with an allowed type), or resources is not an object. It is thrown in validateDependencyIndexShape (imports.ts:704-715) with HTTP 400 to reject malformed packages early.

Source

Thrown at packages/server/src/sdk/workspace/projects/backups/imports.ts:714

    isRecord(value) &&
    typeof value.id === "string" &&
    typeof value.name === "string" &&
    isAllowedImportType(value.type) &&
    ALLOWED_IMPORT_TYPES.has(value.type)
  )
}

const validateDependencyIndexShape = (
  dependencyIndex: ProjectPackageDependencyIndex
) => {
  if (
    !isRecord(dependencyIndex) ||
    typeof dependencyIndex.rootProjectId !== "string" ||
    !Array.isArray(dependencyIndex.directMembers) ||
    !dependencyIndex.directMembers.every(validateUsedResource) ||
    !isRecord(dependencyIndex.resources)
  ) {
    throw new HTTPError("Project package dependency index is invalid.", 400)
  }

  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

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Regenerate the project package using the official export flow so dependency-index.json is written with correct rootProjectId, directMembers and resources fields.
  2. Open dependency-index.json from the package and confirm it has string rootProjectId, an object resources keyed by doc id, and directMembers entries shaped {id: string, name: string, type: <allowed type>}.
  3. Re-export from the source environment rather than editing an old package in place; check the package formatVersion in project.json matches the target Budibase version.
  4. Verify the archive is complete and not truncated (compare file counts against the manifest).

Example fix

// before (invalid index)
{ "directMembers": [{ "id": "ds_1" }], "resources": [] }
// after (valid index)
{ "rootProjectId": "app_abc", "directMembers": [{ "id": "ds_1", "name": "My DB", "type": "datasource" }], "resources": { "app_abc": { "dependencies": [] } } }
Defensive patterns

Strategy: validation

Validate before calling

const isValidIndex = (idx) =>
  !!idx && typeof idx === "object" &&
  typeof idx.rootProjectId === "string" &&
  Array.isArray(idx.directMembers) &&
  idx.directMembers.every(m => m && typeof m.id === "string" && typeof m.name === "string" && typeof m.type === "string") &&
  !!idx.resources && typeof idx.resources === "object" && !Array.isArray(idx.resources)

Type guard

const isDependencyIndex = (v) =>
  typeof v === "object" && v !== null &&
  "rootProjectId" in v && typeof v.rootProjectId === "string" &&
  Array.isArray(v.directMembers) && typeof v.resources === "object" && v.resources !== null

Try / catch

try {
  await importProjectPackage(file)
} catch (e) {
  if (e.status === 400 && e.message.includes("dependency index is invalid")) {
    // surface 'malformed dependency-index.json' to the user, prompt re-export
  } else throw e
}

Prevention

When it happens

Trigger: Importing a project package whose dependency-index.json is missing rootProjectId, has a non-string rootProjectId, has a directMembers array containing entries lacking id/name or with a disallowed type, or whose resources field is missing or not an object. Also triggered by hand-crafted or truncated packages.

Common situations: Manually edited or generated dependency-index.json (e.g. scripts that build export archives), older-format packages renamed from workspace/app exports without regenerating the index, archives corrupted or partially extracted, or JSON where resources was replaced with an array instead of a keyed object.

Related errors


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