{"record":{"id":"7b1e697edb5cd8be","repo":"HeyPuter/puter","slug":"unauthorized-7b1e69","errorCode":"unauthorized","errorMessage":"Authentication required","messagePattern":"Authentication required","errorType":"http","errorClass":"HttpError","httpStatus":401,"severity":"error","filePath":"src/backend/drivers/ai-video/providers/gemini/GeminiVideoProvider.ts","lineNumber":142,"sourceCode":"        const is4K = videoResolution === '4k';\n        const is1080p = videoResolution === '1080p';\n        const perSecondCents = is4K\n            ? (selectedModel.costs?.['per-second-4k'] ??\n              selectedModel.costs?.['per-second'])\n            : is1080p\n              ? (selectedModel.costs?.['per-second-1080p'] ??\n                selectedModel.costs?.['per-second'])\n              : selectedModel.costs?.['per-second'];\n        if (perSecondCents === undefined) {\n            throw new Error(\n                `No per-second cost configured for video model '${selectedModel.id}'`,\n            );\n        }\n        const perSecondMicroCents = Math.ceil(perSecondCents * 1_000_000);\n\n        const actor = Context.get('actor');\n        if (!actor) {\n            throw new HttpError(401, 'Authentication required', {\n                legacyCode: 'unauthorized',\n            });\n        }\n\n        // Clamp the clip to what remaining credit buys instead of rejecting\n        // the request outright. 1080p/4k and reference-image renders are\n        // locked to 8s by the upstream API, so those stay all-or-nothing.\n        durationSeconds = await capSecondsToRemainingCredits({\n            metering: this.#meteringService,\n            actor,\n            perSecondMicroCents,\n            requestedSeconds: durationSeconds,\n            allowedSeconds:\n                isHighRes || hasRefImages\n                    ? [durationSeconds]\n                    : selectedModel.durationSeconds,\n            modelId: selectedModel.id,\n        });","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/HeyPuter/puter/blob/908ec23eda38526170322c3edf71ba45ecb1ca95/src/backend/drivers/ai-video/providers/gemini/GeminiVideoProvider.ts#L124-L160","documentation":"Error \"Authentication required\" thrown in HeyPuter/puter.","triggerScenarios":"Thrown at src/backend/drivers/ai-video/providers/gemini/GeminiVideoProvider.ts:142 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"}