can1357/oh-my-pi · error

imageshack response did not include direct image coordinates

Error message

imageshack response did not include direct image coordinates

What it means

To build the direct image URL, ImageShack returns server, bucket, and filename coordinates. The uploader requires server and bucket to be string or number, and filename to be a non-empty string; otherwise it throws this error. Without these three parts the imagizer.imageshack.com direct link cannot be assembled.

Source

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

				}),
			});
			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,
			});
		},
	};
}

function oauthEncode(value: string): string {
	return encodeURIComponent(value).replace(
		/[!'()*]/g,
		character => `%${character.charCodeAt(0).toString(16).toUpperCase()}`,
	);
}

function oauthBaseUrl(value: string): string {
	const url = new URL(value);

View on GitHub (pinned to 9690622007)

Solutions

  1. Log the full image object to see which coordinate is missing or wrongly typed
  2. Update field mapping if ImageShack renamed or restructured server/bucket/filename
  3. Verify the image was not quarantined (moderation) which omits direct coordinates
  4. Fall back to another image host or use an alternative URL field if the host provides one
Defensive patterns

Strategy: type-guard

Validate before calling

const img = payload.result.images[0];
const coordsOk = (typeof img?.server === "string" || typeof img?.server === "number")
  && (typeof img?.bucket === "string" || typeof img?.bucket === "number")
  && typeof img?.filename === "string" && img.filename.length > 0;
if (!coordsOk) throw new Error("imageshack image missing server/bucket/filename");

Type guard

function hasDirectCoordinates(image) {
  return (typeof image?.server === "string" || typeof image?.server === "number")
    && (typeof image?.bucket === "string" || typeof image?.bucket === "number")
    && typeof image?.filename === "string" && image.filename.length > 0;
}

Try / catch

try {
  const pub = await broker.publish(request);
} catch (err) {
  if (err.message === "imageshack response did not include direct image coordinates") {
    logger.warn("imageshack image object incomplete", { image });
    return fallbackUploader.publish(request);
  }
  throw err;
}

Prevention

When it happens

Trigger: The first image in result.images lacks server, bucket, or a non-empty filename — host omitted fields, types changed (e.g. server as object), or filename is empty.

Common situations: ImageShack API schema drift on the image object; partial moderation responses; test mocks with incomplete image records.

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/e8fb7502c50a3e68. Report an issue: GitHub.