can1357/oh-my-pi · error · LegacyDestinationError
the replacement endpoint omitted the uploaded URL
Error message
the replacement endpoint omitted the uploaded URL
What it means
Thrown when the replacement endpoint responds without errors but also without any recognizable URL field — none of direct_url, directUrl, or url hold a non-empty string. The uploader needs a direct URL to publish and refuses to return a publication without one.
Source
Thrown at packages/coding-agent/src/blob-broker/uploaders-legacy.ts:352
}
}
return {
destination,
async upload(request) {
try {
const response = await fetchFor(config)(endpoint, {
method: "PUT",
body: multipartFile(request, "file", { api_key: apiKey }),
});
await expectOk(response, destination);
const data = await jsonObject(destination, response);
const errors = data.errors;
if (Array.isArray(errors) && errors.length > 0) {
throw new LegacyDestinationError(destination, "the replacement endpoint rejected the upload");
}
const raw = firstString(data, ["direct_url", "directUrl", "url"]);
if (!raw)
throw new LegacyDestinationError(destination, "the replacement endpoint omitted the uploaded URL");
return publication(destination, request, httpUrl(destination, raw, resultBaseUrl));
} catch (error) {
throw failure(destination, error);
}
},
};
}
function createLobFileUploader(config: DestinationRuntimeConfig, endpoint: URL): BlobUploader {
const destination = "lobfile" as const;
const apiKey = requireCredential(config, "apiKey");
return {
destination,
async upload(request) {
try {
const response = await fetchFor(config)(endpoint, {
method: "POST",
body: multipartFile(request, "file", { api_key: apiKey }),View on GitHub (pinned to 9690622007)
Solutions
- Capture the response body and compare its keys with the expected direct_url/directUrl/url fields
- Check for a service version change and update the endpoint or adapter configuration
- Ensure no middleware/proxy is rewriting the response body
- If the endpoint returns relative URLs, verify resultBaseUrl is set so the URL can be resolved
Example fix
// before: endpoint returns { link: "..." } which is not recognized
endpoint: "https://host.example/upload"
// after: use an endpoint emitting the expected field or set a compatible one
endpoint: "https://host.example/api/upload" // returns { url: "https://host/i/abc.png" } Defensive patterns
Strategy: validation
Validate before calling
// verify the endpoint returns one of the recognized URL fields before adopting it
const probe = await fetch(endpoint, { method: "POST", body: tinyFixture });
const body = await probe.json();
if (!["direct_url", "directUrl", "url"].some((k) => typeof body?.[k] === "string")) {
throw new Error("endpoint response lacks a recognized direct URL field");
} Type guard
function hasRecognizedUrlField(data: unknown): data is { url: string } {
const r = data as Record<string, unknown>;
return typeof r?.url === "string" && r.url.trim().length > 0;
} Try / catch
try {
await uploader.upload(request);
} catch (err) {
if (err instanceof Error && /omitted the uploaded URL/.test(err.message)) {
// inspect the endpoint schema; map or transform before using this uploader
}
throw err;
} Prevention
- Confirm the endpoint's JSON field names before wiring it up
- Set resultBaseUrl when the service returns relative URLs
- Guard against proxies/HTML interstitials replacing the JSON body
- Add an integration probe test for the replacement endpoint
When it happens
Trigger: POST to the replacement endpoint returns valid JSON whose errors array is empty/absent but which lacks all three URL keys — typically a schema mismatch or an HTML/other body that happened to parse as JSON.
Common situations: Self-hosted endpoint returning a different response shape than expected; service version drift renaming url fields; a proxy rewriting the response; the service returning a session/HTML page instead of the upload result.
Related errors
- the replacement endpoint rejected the upload
- the replacement endpoint did not return a direct image URL
- the upload response omitted URL components
- the replacement endpoint returned no direct URL
- flickr response did not include a photo ID
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/aff69be10a410997.
Report an issue: GitHub.