earendil-works/pi · error

Custom fetch is not supported by the Google Generative AI ad

Error message

Custom fetch is not supported by the Google Generative AI adapter

What it means

Error "Custom fetch is not supported by the Google Generative AI adapter" thrown in earendil-works/pi.

Source

Thrown at packages/ai/src/api/google-generative-ai.ts:81

			content: [],
			api: "google-generative-ai" as Api,
			provider: model.provider,
			model: model.id,
			usage: {
				input: 0,
				output: 0,
				cacheRead: 0,
				cacheWrite: 0,
				totalTokens: 0,
				cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },
			},
			stopReason: "pending",
			timestamp: Date.now(),
		};

		try {
			if (options?.fetch && options.fetch !== globalThis.fetch) {
				throw new Error("Custom fetch is not supported by the Google Generative AI adapter");
			}
			const apiKey = options?.apiKey;
			if (!apiKey) {
				throw new Error(`No API key for provider: ${model.provider}`);
			}
			const client = createClient(model, apiKey, options?.headers);
			let params = buildParams(model, context, options);
			const nextParams = await options?.onPayload?.(params, model);
			if (nextParams !== undefined) {
				params = nextParams as GenerateContentParameters;
			}
			const googleStream = await retryGoogleRequest(() => client.models.generateContentStream(params), options);

			stream.push({ type: "start", partial: output });
			let currentBlock: TextContent | ThinkingContent | null = null;
			const blocks = output.content;
			const blockIndex = () => blocks.length - 1;
			for await (const chunk of googleStream) {

View on GitHub (pinned to 4af9d21d3b)

Solutions

  1. Use the default fetch; the Google Generative AI adapter manages its own transport.

When it happens

Trigger: Thrown at packages/ai/src/api/google-generative-ai.ts:81 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of earendil-works/pi@4af9d21d3b (2026-08-24). Data as JSON: /api/errors/bcfd402c9bfdc04c. Report an issue: GitHub.