Budibase/budibase · error

Project '${projectId}' not found

Error message

Project '${projectId}' not found

What it means

exportProject loads the workspace/project document via sdk.projects.get(projectId) before building the export tar. If the returned project is falsy, it throws this plain Error because an export cannot proceed without the project metadata. Note the separate earlier check for workspaceId, so this specifically means the project document itself was not found.

Source

Thrown at packages/server/src/sdk/workspace/projects/backups/exports.ts:324

      await encryptDirectory(fullPath, password)
    }
  }
}

export async function exportProject(
  projectId: string,
  opts?: {
    encryptPassword?: string
  }
) {
  const workspaceId = context.getWorkspaceId()
  if (!workspaceId) {
    throw new Error("Could not determine workspace for Project export")
  }

  const project = await sdk.projects.get(projectId)
  if (!project) {
    throw new Error(`Project '${projectId}' not found`)
  }

  const graph = await sdk.resources.getResourcesInfo()
  const projectDependencies = sortResources(
    Array.from(
      new Map(
        (graph[projectId]?.dependencies || []).map(resource => [
          resource.id,
          resource,
        ])
      ).values()
    )
  )
  const [agents, workspaceApps] = await Promise.all([
    sdk.ai.agents.fetch(),
    sdk.workspaceApps.fetch(),
  ])
  const directMembers = await getDirectMembers(projectId)

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Verify the projectId exists (list workspaces/apps) and is passed with correct casing/prefix
  2. Ensure the export runs inside the correct workspace context
  3. Check the app was not recently deleted (recycle bin) and restore it if needed
  4. Re-run the export after confirming app health

Example fix

// before
await exportProject({ projectId: copiedFromOtherEnv })
// after
const project = await sdk.projects.get(projectId)
if (!project) {
  throw new Error(`Cannot export: project ${projectId} missing in this tenant`)
}
await exportProject({ projectId })
Defensive patterns

Strategy: validation

Validate before calling

const project = await sdk.projects.get(projectId)
if (!project) throw new Error(`Project ${projectId} not found in this tenant; aborting export`)

Type guard

function projectExists(
  p: Project | undefined | null
): p is Project {
  return !!p && typeof p._id === "string"
}

Try / catch

try {
  await exportProject({ projectId })
} catch (e) {
  if (String(e.message).includes("not found")) {
    // verify app id / workspace context before retrying
  } else throw e
}

Prevention

When it happens

Trigger: Calling exportProject with a projectId/appId that does not exist in the current tenant, was deleted, or where the context is set to a different workspace so the lookup misses; also when get() swallows a DB error and returns undefined.

Common situations: Automations/scripts exporting an app id from a different environment; app deleted while an export job was queued; typos or missing prefix in the project id; backups running against an app mid-deletion.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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