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: ProjectPackageManifestView on GitHub (pinned to a81a902e9a)
Solutions
- Regenerate the project package using the official export flow so dependency-index.json is written with correct rootProjectId, directMembers and resources fields.
- 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>}.
- 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.
- 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
- Always produce packages with the official export endpoint, never hand-write dependency-index.json
- Validate the index against the shape {rootProjectId, directMembers[{id,name,type}], resources{}} before uploading
- Check the package formatVersion matches your server version
- Test archives extract fully and pass a JSON parse on every file
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
- Cannot make field "${key}" required, it has a default value.
- Project package dependency index does not match project.json
- 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.
AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29).
Data as JSON: /api/errors/c3593fe001c86dcf.
Report an issue: GitHub.