{"record":{"id":"5299d322782f9f42","repo":"can1357/oh-my-pi","slug":"flickr-rejected-the-upload","errorCode":null,"errorMessage":"flickr rejected the upload","messagePattern":"flickr rejected the upload","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/blob-broker/uploaders-image-hosts.ts","lineNumber":242,"sourceCode":"\t\t[\"description\", \"description\"],\n\t\t[\"tags\", \"tags\"],\n\t\t[\"isPublic\", \"is_public\"],\n\t\t[\"isFriend\", \"is_friend\"],\n\t\t[\"isFamily\", \"is_family\"],\n\t\t[\"safetyLevel\", \"safety_level\"],\n\t\t[\"contentType\", \"content_type\"],\n\t\t[\"hidden\", \"hidden\"],\n\t] as const;\n\tfor (const [option, parameter] of mappings) {\n\t\tconst value = optionString(config, option);\n\t\tif (value) fields[parameter] = value;\n\t}\n\treturn fields;\n}\n\nfunction flickrPhotoId(xml: string): string {\n\tconst status = /<rsp\\b[^>]*\\b(?:stat|status)=[\"']([^\"']+)[\"']/i.exec(xml)?.[1];\n\tif (status && status !== \"ok\") throw new Error(\"flickr rejected the upload\");\n\tconst photoId = /<photoid\\b[^>]*>([^<]+)<\\/photoid>/i.exec(xml)?.[1]?.trim();\n\tif (!photoId) throw new Error(\"flickr response did not include a photo ID\");\n\treturn photoId;\n}\n\nfunction largestFlickrSource(payload: Record<string, unknown>): string {\n\tif (payload.stat !== \"ok\") throw new Error(\"flickr getSizes request failed\");\n\tconst sizes = nestedRecord(payload, \"sizes\", \"flickr\").size;\n\tif (!Array.isArray(sizes)) throw new Error(\"flickr getSizes response did not include sizes\");\n\tfor (let index = sizes.length - 1; index >= 0; index--) {\n\t\tconst size = sizes[index];\n\t\tif (size && typeof size === \"object\" && !Array.isArray(size)) {\n\t\t\tconst source = (size as Record<string, unknown>).source;\n\t\t\tif (typeof source === \"string\" && source) return directUrl(source, \"flickr\");\n\t\t}\n\t}\n\tthrow new Error(\"flickr getSizes response did not include a direct image URL\");\n}","sourceCodeStart":224,"sourceCodeEnd":260,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/blob-broker/uploaders-image-hosts.ts#L224-L260","documentation":"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.","triggerScenarios":"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.","commonSituations":"Expired Flickr OAuth/upload token; wrong api_key; exceeding upload quota; forbidden content per Flickr guidelines; account restrictions (e.g. unverified email).","solutions":["Extract the <err code/msg> from the response XML to see Flickr's specific failure reason","Re-authenticate and refresh the Flickr access token","Verify the api_key and account upload quota/permissions","Retry later if it's a rate/limit issue, or fall back to another host"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const status = /<rsp\\b[^>]*\\b(?:stat|status)=[\"']([^\"']+)[\"']/i.exec(xml)?.[1];\nif (status && status !== \"ok\") {\n  const errDetail = /<err\\b[^>]*\\bmsg=[\"']([^\"']+)[\"']/i.exec(xml)?.[1];\n  throw new Error(`flickr upload failed: ${status} ${errDetail ?? \"\"}`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  const pub = await broker.publish(request);\n} catch (err) {\n  if (err.message === \"flickr rejected the upload\") {\n    logger.warn(\"flickr upload rejected\", { responseSnippet: xml.slice(0, 500) });\n    return fallbackUploader.publish(request);\n  }\n  throw err;\n}","preventionTips":["Refresh Flickr tokens before expiry; re-authenticate on stat=fail","Extract and monitor the <err code/msg> attributes in Flickr XML responses","Verify api_key validity and account upload quota/permissions","Retry with backoff for rate-limit failures and use a fallback host otherwise"],"tags":["flickr","api-error","auth","xml","upload-rejected"],"backgroundTag":"upload-rejected-by-host","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}