can1357/oh-my-pi · error

flickr response did not include a photo ID

Error message

flickr response did not include a photo ID

What it means

This error is thrown by flickrPhotoId() when parsing the XML response from Flickr's upload API: the response either had no <photoid> element or it was empty. Flickr only returns a photo ID after a successful upload, so a missing ID means the upload result cannot be turned into a public URL.

Source

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

		["isPublic", "is_public"],
		["isFriend", "is_friend"],
		["isFamily", "is_family"],
		["safetyLevel", "safety_level"],
		["contentType", "content_type"],
		["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 {

View on GitHub (pinned to 9690622007)

Solutions

  1. Verify the Flickr API key/secret credentials in the destination config are valid and have upload scope
  2. Log the raw XML response from the upload call to see what Flickr actually returned
  3. Check whether the response is HTML (proxy/portal interception) and whitelist the api.flickr.com endpoint
  4. Retry the upload; if it persists, confirm the Flickr upload API contract is unchanged

Example fix

// before
const photoId = /<photoid\b[^>]*>([^<]+)<\/photoid>/i.exec(xml)?.[1]?.trim();
// after — log the payload to diagnose
const photoId = /<photoid\b[^>]*>([^<]+)<\/photoid>/i.exec(xml)?.[1]?.trim();
if (!photoId) throw new Error(`flickr response did not include a photo ID: ${xml.slice(0, 500)}`);
Defensive patterns

Strategy: try-catch

Validate before calling

const looksLikeFlickrRsp = (xml: string) => /<rsp\b[^>]*stat=["']ok["']/i.test(xml) && /<photoid\b[^>]*>[^<]+<\/photoid>/i.test(xml);
if (!looksLikeFlickrRsp(rawXml)) console.warn("flickr upload response lacks photoid; aborting URL resolution");

Type guard

function hasPhotoId(xml: string): boolean {
	return /<photoid\b[^>]*>([^<]+)<\/photoid>/i.test(xml);
}

Try / catch

try {
	const id = flickrPhotoId(xml);
} catch (err) {
	if (err instanceof Error && err.message.includes("photo ID")) {
		// log raw xml, fall back to re-upload or alternate host
	}
	throw err;
}

Prevention

When it happens

Trigger: The Flickr upload endpoint returned HTTP 200 but the XML body lacked a <photoid>...</photoid> element — e.g. an unexpected response envelope, a proxy/error page returned with status ok absent, or the regex stat attribute parsed as 'ok' while the body was truncated or HTML.

Common situations: Flickr API changes or deprecation, an API key without upload permission returning an unusual response, a corporate proxy or captive portal injecting HTML, or network gear truncating the response body.

Related errors


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