{"record":{"id":"8d474dfe0ddbf67f","repo":"HeyPuter/puter","slug":"unauthorized-8d474d","errorCode":"unauthorized","errorMessage":"Authentication required","messagePattern":"Authentication required","errorType":"http","errorClass":"HttpError","httpStatus":401,"severity":"error","filePath":"src/backend/drivers/ai-video/VideoGenerationDriver.ts","lineNumber":124,"sourceCode":"                    (model as { costs?: Record<string, number> }).costs ?? {},\n                )) {\n                    if (typeof raw !== 'number' || !Number.isFinite(raw))\n                        continue;\n                    out.push({\n                        usageType: `${model.provider}:${model.id}:${costKey}`,\n                        costValue: raw,\n                        source: `driver:aiVideo/${model.provider}`,\n                    });\n                }\n            }\n        }\n        return out;\n    }\n\n    async generate(args: IGenerateVideoParams) {\n        const actor = Context.get('actor') as Actor | undefined;\n        if (!actor)\n            throw new HttpError(401, 'Authentication required', {\n                legacyCode: 'unauthorized',\n            });\n\n        const puterOutputPath = args.puter_output_path;\n        delete args.puter_output_path;\n\n        // Validate the output path early — before spending credits.\n        let resolvedOutputPath: string | undefined;\n        if (puterOutputPath) {\n            const username = actor.user?.username;\n            const userId = actor.user?.id;\n            if (!userId || !username) {\n                throw new HttpError(\n                    400,\n                    'User ID required for puter_output_path',\n                    { legacyCode: 'bad_request' },\n                );\n            }","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/HeyPuter/puter/blob/908ec23eda38526170322c3edf71ba45ecb1ca95/src/backend/drivers/ai-video/VideoGenerationDriver.ts#L106-L142","documentation":"Error \"Authentication required\" thrown in HeyPuter/puter.","triggerScenarios":"Thrown at src/backend/drivers/ai-video/VideoGenerationDriver.ts:124 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Authenticate the request with a valid user or app token.","Ensure the caller is signed in before invoking the video generation driver."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"908ec23eda38526170322c3edf71ba45ecb1ca95","analyzedAt":"2026-08-12T20:53:15.911Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}