{"record":{"id":"eb7797bfa92809c5","repo":"HeyPuter/puter","slug":"not-found-eb7797","errorCode":"not_found","errorMessage":"App not found","messagePattern":"App not found","errorType":"http","errorClass":"HttpError","httpStatus":404,"severity":"error","filePath":"src/backend/controllers/fs/LegacyFSController.ts","lineNumber":1287,"sourceCode":"            if (!username || !appUid)\n                throw new HttpError(403, 'Forbidden', {\n                    legacyCode: 'forbidden',\n                });\n            appDataRoot = `/${username}/AppData/${appUid}`;\n        }\n\n        type SignedOrEmpty =\n            (SignedFile & { path?: string }) | Record<string, never>;\n        const result: { signatures: SignedOrEmpty[]; token?: string } = {\n            signatures: [],\n        };\n\n        // Optional app grant: provide app_uid to grant permissions + token.\n        let grantApp: { uid: string } | null = null;\n        if (typeof body.app_uid === 'string' && body.app_uid.length > 0) {\n            const app = await this.stores.app.getByUid(body.app_uid);\n            if (!app)\n                throw new HttpError(404, 'App not found', {\n                    legacyCode: 'not_found',\n                });\n            grantApp = { uid: app.uid };\n            result.token = await this.services.auth.getUserAppToken(\n                actor,\n                app.uid,\n            );\n        }\n\n        for (const rawItem of items) {\n            const item = asRecord(rawItem);\n            const uid = typeof item.uid === 'string' ? item.uid : undefined;\n            const path = typeof item.path === 'string' ? item.path : undefined;\n            const action =\n                typeof item.action === 'string' ? item.action : 'read';\n            if (!uid && !path) {\n                result.signatures.push({});\n                continue;","sourceCodeStart":1269,"sourceCodeEnd":1305,"githubUrl":"https://github.com/HeyPuter/puter/blob/908ec23eda38526170322c3edf71ba45ecb1ca95/src/backend/controllers/fs/LegacyFSController.ts#L1269-L1305","documentation":"Thrown by POST /sign when the body includes a non-empty `app_uid` (requesting an app grant + token alongside the signatures) but no app exists with that uid in the app store. The optional-grant path looks the app up and 404s when it cannot find it, since there is nothing to grant to.","triggerScenarios":"POST /sign with body.app_uid pointing to a deleted app, a typo'd uid, or an app uid from a different environment (e.g. staging uid used against production).","commonSituations":"Hardcoded app_uid that was removed; copy-paste error; cross-environment config bleed; app pending approval not yet in the store.","solutions":["Verify the app_uid exists: list apps or check the app's dashboard/registry before sending.","Drop body.app_uid if you do not need the app-grant + token (the signatures are returned without it).","Regenerate the uid from the current environment's app store rather than reusing one from elsewhere."],"exampleFix":"// before\nawait fetch('/sign', { method:'POST', body: JSON.stringify({ items, app_uid: 'old-uid' }) })\n// after — either omit app_uid, or use a verified one\nawait fetch('/sign', { method:'POST', body: JSON.stringify({ items }) })","handlingStrategy":"validation","validationCode":"// verify the app exists (or omit app_uid) before signing\nasync function resolveAppUid(appStore, appUid) {\n  if (!appUid) return null;\n  const app = await appStore.getByUid(appUid);\n  if (!app) throw new Error(`app_uid ${appUid} not found; drop it or correct it`);\n  return app.uid;\n}","typeGuard":null,"tryCatchPattern":"try { await fetch('/sign', { method:'POST', body: JSON.stringify({ items, app_uid }) }); }\ncatch (e) { if (e.code === 'not_found' && /app/i.test(e.message)) { appUid = undefined; /* retry without grant */ } else throw e; }","preventionTips":["Only pass app_uid when you actually need the grant+token.","Source app_uid from the live app store, not a hardcoded constant.","Treat a 404 here as recoverable: retry without app_uid."],"tags":["validation","app-uid","not-found","sign"],"backgroundTag":null,"analyzedSha":"908ec23eda38526170322c3edf71ba45ecb1ca95","analyzedAt":"2026-08-12T20:53:15.911Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}