can1357/oh-my-pi · error
${destination} response did not include ${key}
Error message
${destination} response did not include ${key} What it means
requiredString asserts that a key in the parsed response record is a non-empty string (used for `id` and `url`). If the key is missing, null, another type, or an empty string, this error is thrown naming the destination and the expected key. It signals the host's response did not contain a required field.
Source
Thrown at packages/coding-agent/src/blob-broker/uploaders-image-hosts.ts:58
value = await response.json();
} catch {
throw new Error(`${destination} returned invalid JSON`);
}
return responseRecord(value, destination);
}
function nestedRecord(
record: Record<string, unknown>,
key: string,
destination: BlobDestinationId,
): Record<string, unknown> {
return responseRecord(record[key], destination);
}
function requiredString(record: Record<string, unknown>, key: string, destination: BlobDestinationId): string {
const value = record[key];
if (typeof value !== "string" || value.length === 0) {
throw new Error(`${destination} response did not include ${key}`);
}
return value;
}
function directUrl(value: string, destination: BlobDestinationId): string {
let url: URL;
try {
url = new URL(value);
} catch {
throw new Error(`${destination} returned an invalid image URL`);
}
if (url.protocol !== "https:" && url.protocol !== "http:") {
throw new Error(`${destination} returned an invalid image URL`);
}
return url.href;
}
function createImgurUploader(config: DestinationRuntimeConfig): BlobUploader {View on GitHub (pinned to 9690622007)
Solutions
- Log the full response object to see which key is absent and what shape the host now uses
- Update expectations if the host renamed the field (schema drift)
- Treat repeated occurrences as an API change and pin/upgrade the destination integration
- Catch and fall back to another image host
Defensive patterns
Strategy: type-guard
Validate before calling
const payload = await response.json();
if (typeof payload?.url !== "string" || payload.url.length === 0) throw new Error("host response missing url"); Type guard
function hasStringField(record, key) {
return typeof record?.[key] === "string" && record[key].length > 0;
} Try / catch
try {
const pub = await broker.publish(request);
} catch (err) {
if (err.message.includes("response did not include")) {
logger.warn("host response schema drift", { destination, message: err.message });
return fallbackUploader.publish(request);
}
throw err;
} Prevention
- Log the full response object on failure to detect schema drift
- Track image host API changelogs for renamed/nested fields
- Validate host responses once in an integration smoke test
- Fall back to another host rather than treating one bad response as fatal
When it happens
Trigger: Response object lacks the expected key; the key holds a number/null/array instead of a string; the key holds an empty string after upload.
Common situations: Image host changed its JSON schema (renamed or nested the field); upload 'succeeded' per status but the resource was quarantined so no URL was issued; partial/mock responses in tests.
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
- OpenAI Files API upload response is missing a file id
- ${destination} returned an invalid response
- ${destination} returned an invalid image URL
- imageshack response did not include an image
- imageshack response did not include direct image coordinates
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/a318685b28db6530.
Report an issue: GitHub.