can1357/oh-my-pi · error

flickr getSizes request failed

Error message

flickr getSizes request failed

What it means

largestFlickrSource() throws this when the JSON payload from Flickr's flickr.photos.getSizes call has stat !== 'ok', meaning the API call itself failed (auth problem, invalid photo ID, Flickr error). The uploader cannot resolve a direct image URL without a successful getSizes response.

Source

Thrown at packages/coding-agent/src/blob-broker/uploaders-image-hosts.ts:249

		["hidden", "hidden"],
	] as const;
	for (const [option, parameter] of mappings) {
		const value = optionString(config, option);
		if (value) fields[parameter] = value;
	}
	return fields;
}

function flickrPhotoId(xml: string): string {
	const status = /<rsp\b[^>]*\b(?:stat|status)=["']([^"']+)["']/i.exec(xml)?.[1];
	if (status && status !== "ok") throw new Error("flickr rejected the upload");
	const photoId = /<photoid\b[^>]*>([^<]+)<\/photoid>/i.exec(xml)?.[1]?.trim();
	if (!photoId) throw new Error("flickr response did not include a photo ID");
	return photoId;
}

function largestFlickrSource(payload: Record<string, unknown>): string {
	if (payload.stat !== "ok") throw new Error("flickr getSizes request failed");
	const sizes = nestedRecord(payload, "sizes", "flickr").size;
	if (!Array.isArray(sizes)) throw new Error("flickr getSizes response did not include sizes");
	for (let index = sizes.length - 1; index >= 0; index--) {
		const size = sizes[index];
		if (size && typeof size === "object" && !Array.isArray(size)) {
			const source = (size as Record<string, unknown>).source;
			if (typeof source === "string" && source) return directUrl(source, "flickr");
		}
	}
	throw new Error("flickr getSizes response did not include a direct image URL");
}

function createFlickrUploader(config: DestinationRuntimeConfig): BlobUploader {
	const credentials: FlickrOAuthCredentials = {
		consumerKey: requireCredential(config, "apiKey"),
		consumerSecret: requireCredential(config, "apiSecret"),
		token: requireCredential(config, "oauthToken"),
		tokenSecret: requireCredential(config, "oauthTokenSecret"),

View on GitHub (pinned to 9690622007)

Solutions

  1. Re-check the Flickr apiKey/apiSecret and OAuth token in the destination config
  2. Inspect the getSizes response body for Flickr's error code and message (e.g. 1: Photo not found, 98: Invalid auth token)
  3. Re-authenticate to obtain a fresh OAuth token
  4. Retry after confirming the photo ID returned by the upload step is valid

Example fix

// before
if (payload.stat !== "ok") throw new Error("flickr getSizes request failed");
// after — surface Flickr's own message
if (payload.stat !== "ok") {
	const msg = typeof payload.message === "string" ? payload.message : "unknown flickr error";
	throw new Error(`flickr getSizes request failed (${payload.code ?? "?"}): ${msg}`);
}
Defensive patterns

Strategy: retry

Validate before calling

if (!oauthToken || isTokenExpired(oauthToken)) await refreshFlickrToken(config);

Type guard

function isFlickrOk(payload: Record<string, unknown>): boolean {
	return payload.stat === "ok";
}

Try / catch

try {
	const src = await largestFlickrSource(payload);
} catch (err) {
	if (err instanceof Error && err.message === "flickr getSizes request failed") {
		await refreshFlickrToken();
		return retryGetSizes();
	}
	throw err;
}

Prevention

When it happens

Trigger: Calling flickr.photos.getSizes with a photo ID that does not exist, is private, or whose OAuth signature/token is rejected — Flickr replies with stat: 'fail' and an error code/message.

Common situations: Expired or revoked Flickr OAuth token, photo deleted between upload and getSizes, wrong API key/secret pair, or Flickr rate limiting.

Understand the failure class

Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/d9ad2ec2970af2b2. Report an issue: GitHub.