can1357/oh-my-pi · error

flickr rejected the upload

Error message

flickr rejected the upload

What it means

The Flickr uploader receives an XML response and checks the rsp element's stat/status attribute. If it is present and not "ok", Flickr rejected the upload and this error is thrown. This is the explicit failure branch when parsing Flickr's XML-RPC style upload response.

Source

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

		["description", "description"],
		["tags", "tags"],
		["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");
}

View on GitHub (pinned to 9690622007)

Solutions

  1. Extract the <err code/msg> from the response XML to see Flickr's specific failure reason
  2. Re-authenticate and refresh the Flickr access token
  3. Verify the api_key and account upload quota/permissions
  4. Retry later if it's a rate/limit issue, or fall back to another host
Defensive patterns

Strategy: try-catch

Validate before calling

const status = /<rsp\b[^>]*\b(?:stat|status)=["']([^"']+)["']/i.exec(xml)?.[1];
if (status && status !== "ok") {
  const errDetail = /<err\b[^>]*\bmsg=["']([^"']+)["']/i.exec(xml)?.[1];
  throw new Error(`flickr upload failed: ${status} ${errDetail ?? ""}`);
}

Try / catch

try {
  const pub = await broker.publish(request);
} catch (err) {
  if (err.message === "flickr rejected the upload") {
    logger.warn("flickr upload rejected", { responseSnippet: xml.slice(0, 500) });
    return fallbackUploader.publish(request);
  }
  throw err;
}

Prevention

When it happens

Trigger: Flickr returns <rsp stat="fail"> with an err element — invalid api_key/token, expired token, insufficient permissions, or upload limits — and the regex captures a non-ok status.

Common situations: Expired Flickr OAuth/upload token; wrong api_key; exceeding upload quota; forbidden content per Flickr guidelines; account restrictions (e.g. unverified email).

Related errors


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