can1357/oh-my-pi · error

imageshack response did not include an image

Error message

imageshack response did not include an image

What it means

After success:true, the ImageShack uploader expects payload.result.images to be a non-empty array. If `result` has no `images` array or it is empty, this error is thrown. It detects responses where the upload nominally succeeded but no image entry was produced.

Source

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

	const authToken = requireCredential(config, "authToken");
	const isPublic = optionBoolean(config, "public", false) ?? false;

	return {
		destination: "imageshack",
		async upload(request) {
			const response = await fetchFor(config)(IMAGESHACK_UPLOAD_URL, {
				method: "POST",
				body: multipartFile(request, "file", {
					api_key: apiKey,
					auth_token: authToken,
					public: isPublic ? "y" : "n",
				}),
			});
			const payload = await jsonResponse(response, "imageshack");
			if (payload.success !== true) throw new Error("imageshack rejected the upload");
			const result = nestedRecord(payload, "result", "imageshack");
			if (!Array.isArray(result.images) || result.images.length === 0) {
				throw new Error("imageshack response did not include an image");
			}
			const image = responseRecord(result.images[0], "imageshack");
			const server = image.server;
			const bucket = image.bucket;
			const filename = image.filename;
			if (
				(typeof server !== "string" && typeof server !== "number") ||
				(typeof bucket !== "string" && typeof bucket !== "number") ||
				typeof filename !== "string" ||
				!filename
			) {
				throw new Error("imageshack response did not include direct image coordinates");
			}
			const url = directUrl(`https://imagizer.imageshack.com/a/img${server}/${bucket}/${filename}`, "imageshack");
			return publication("imageshack", request, url, {
				remoteId: typeof image.id === "string" ? image.id : undefined,
			});
		},

View on GitHub (pinned to 9690622007)

Solutions

  1. Log the entire payload to inspect result and result.images
  2. Confirm you are hitting the current ImageShack upload API version
  3. Check whether the image was removed by content moderation despite success:true
  4. Fall back to another image host when the array is empty
Defensive patterns

Strategy: validation

Validate before calling

const payload = await response.json();
if (payload?.success !== true || !Array.isArray(payload?.result?.images) || payload.result.images.length === 0) {
  throw new Error("imageshack response lacks images array: " + JSON.stringify(payload));
}

Type guard

function hasImagesArray(payload) {
  return typeof payload?.result?.images === "object" && Array.isArray(payload.result.images) && payload.result.images.length > 0;
}

Try / catch

try {
  const pub = await broker.publish(request);
} catch (err) {
  if (err.message === "imageshack response did not include an image") {
    logger.warn("imageshack success without image entry", { payload });
    return fallbackUploader.publish(request);
  }
  throw err;
}

Prevention

When it happens

Trigger: payload.result.images is missing, not an array, or an empty array — e.g. ImageShack accepted the request but stripped the image (content filter) or the API shape changed.

Common situations: ImageShack removing uploads by content policy while still returning success; API version drift renaming/nesting `images`; mocked responses lacking the array.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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