can1357/oh-my-pi · error · Error

Destination option endpoint must use HTTP or HTTPS

Error message

Destination option endpoint must use HTTP or HTTPS

What it means

requiredEndpoint() throws this when the endpoint parses as an absolute URL but its protocol is neither https: nor http: (e.g. ftp:, file:, ws:). Only HTTP(S) endpoints are supported for image-host uploads.

Source

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

			}
			const sizesResponse = await fetchFor(config)(getSizesUrl, { method: "GET" });
			const sizes = await jsonResponse(sizesResponse, "flickr");
			return publication("flickr", request, largestFlickrSource(sizes), { remoteId: photoId });
		},
	};
}

function requiredEndpoint(config: DestinationRuntimeConfig): string {
	const endpoint = optionString(config, "endpoint");
	if (!endpoint) throw new Error("Missing required destination option: endpoint");
	let url: URL;
	try {
		url = new URL(endpoint);
	} catch {
		throw new Error("Destination option endpoint must be an absolute URL");
	}
	if (url.protocol !== "https:" && url.protocol !== "http:") {
		throw new Error("Destination option endpoint must use HTTP or HTTPS");
	}
	return url.href;
}

function createCheveretoUploader(config: DestinationRuntimeConfig): BlobUploader {
	const endpoint = requiredEndpoint(config);
	const apiKey = requireCredential(config, "apiKey");

	return {
		destination: "chevereto",
		async upload(request) {
			const response = await fetchFor(config)(endpoint, {
				method: "POST",
				body: multipartFile(request, "source", { key: apiKey, format: "json" }),
			});
			const payload = await jsonResponse(response, "chevereto");
			const image = nestedRecord(payload, "image", "chevereto");
			const url = directUrl(requiredString(image, "url", "chevereto"), "chevereto");

View on GitHub (pinned to 9690622007)

Solutions

  1. Change the endpoint scheme to https:// (preferred) or http:// for local testing
  2. Remove any custom/non-HTTP protocol from the endpoint value
  3. If you genuinely need a non-HTTP transfer, that destination type is unsupported — use an HTTP front-end

Example fix

// before
"endpoint": "ftp://chev.example.com/upload"
// after
"endpoint": "https://chev.example.com/upload"
Defensive patterns

Strategy: validation

Validate before calling

const u = new URL(config.options.endpoint);
if (u.protocol !== "https:" && u.protocol !== "http:") throw new Error(`endpoint scheme '${u.protocol}' unsupported; use http(s)`);

Type guard

function isHttpUrl(value: unknown): value is string {
	if (typeof value !== "string") return false;
	try { const u = new URL(value); return u.protocol === "https:" || u.protocol === "http:"; } catch { return false; }
}

Try / catch

try {
	const href = requiredEndpoint(config);
} catch (err) {
	if (err instanceof Error && err.message.includes("HTTP or HTTPS")) {
		// rewrite scheme to https and retry once
	}
	throw err;
}

Prevention

When it happens

Trigger: Endpoint values like 'ftp://host/upload', 'file:///path', or accidentally including a scheme such as 'javascript:' or a custom protocol in the destination config.

Common situations: Copy-pasting a URL from a non-HTTP tool, intentionally pointing at an internal FTP drop, or a typo like 'httpss://' being parsed as an unknown scheme.

Related errors


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