{"record":{"id":"1954e57dc34d05d6","repo":"Significant-Gravitas/AutoGPT","slug":"no-files-could-be-downloaded","errorCode":null,"errorMessage":"No files could be downloaded.","messagePattern":"No files could be downloaded\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/FilesTab/helpers.ts","lineNumber":90,"sourceCode":"  entries: ZipEntry[],\n  deps: DownloadZipDeps = {},\n): Promise<void> {\n  const fetchImpl = deps.fetchImpl ?? ((url: string) => fetch(url));\n  const save = deps.save ?? triggerDownload;\n  const zip = new JSZip();\n  const used = new Set<string>();\n  let added = 0;\n  for (const entry of entries) {\n    const res = await fetchImpl(fileDownloadUrl(entry.id));\n    if (!res.ok) continue;\n    let name = entry.name || entry.id;\n    while (used.has(name)) name = `${entry.id.slice(0, 8)}-${name}`;\n    used.add(name);\n    zip.file(name, await res.blob());\n    added++;\n  }\n  if (added === 0) {\n    throw new Error(\"No files could be downloaded.\");\n  }\n  const blob = await zip.generateAsync({ type: \"blob\" });\n  save(blob, \"workspace-files.zip\");\n}\n","sourceCodeStart":72,"sourceCodeEnd":95,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/frontend/src/app/(platform)/copilot/components/ContextPanel/components/FilesTab/helpers.ts#L72-L95","documentation":"HTTP 404 from POST /blocks/{block_id}/execute when the user_id resolved from the auth token has no matching user row (get_user_by_id returns None). The request authenticated, but the referenced account no longer exists — typically a deleted user whose token is still being used.","triggerScenarios":"Calling block execution with a valid-signature JWT for an account deleted (or created in another environment) after issuance. Also occurs when auth and app databases are out of sync, e.g. the identity provider knows the user but the platform DB does not.","commonSituations":"Deleted/deactivated account with a live session in a browser or automation; staged user provisioning where auth succeeds before the platform user row is created; tokens copied across environments.","solutions":["Re-authenticate: log out and back in so a fresh token for an existing user is used.","If provisioning, ensure the platform user row is created before issuing tokens for direct block execution.","Handle 404 on this route by clearing the session and redirecting to login."],"exampleFix":"// before\nawait api.post(`/blocks/${blockId}/execute`, data);\n\n// after\nconst resp = await api.post(`/blocks/${blockId}/execute`, data);\nif (resp.status === 404) {\n  await auth.signOut();\n  window.location.href = '/login';\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"const resp = await api.post(`/blocks/${blockId}/execute`, data);\nif (resp.status === 404) {\n  await auth.signOut();       // token references a deleted/nonexistent user\n  window.location.href = '/login';\n}","preventionTips":["Handle 404 on authenticated routes by invalidating the session","Ensure platform user rows exist before issuing tokens during provisioning","Never reuse tokens across environments"],"tags":["auth","user-lifecycle","not-found"],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}