can1357/oh-my-pi · error

Missing required destination option: ${key}

Error message

Missing required destination option: ${key}

What it means

requireOption() reads a value out of a destination runtime's options map and throws when the key is absent. It is the strict accessor for required destination configuration (e.g. bucket name, endpoint URL) — the runtime refuses to start with incomplete config rather than failing later mid-upload. Note it only checks undefined, so an explicitly-set null or empty string still passes through.

Source

Thrown at packages/coding-agent/src/blob-broker/uploader-runtime.ts:48

	readonly remoteId?: string;
}

/** Explicit failure used for destinations that cannot be contacted safely. */
export class DestinationUnavailableError extends Error {
	/** Destination that is unavailable. */
	readonly destination: BlobDestinationId;

	constructor(destination: BlobDestinationId, reason: string) {
		super(`${destination} is unavailable: ${reason}`);
		this.name = "DestinationUnavailableError";
		this.destination = destination;
	}
}

/** Read a required option without coercing its configured type. */
export function requireOption(config: DestinationRuntimeConfig, key: string): DestinationOptionValue {
	const value = config.options[key];
	if (value === undefined) throw new Error(`Missing required destination option: ${key}`);
	return value;
}

/** Read a string option, returning a fallback when it is absent. */
export function optionString(config: DestinationRuntimeConfig, key: string, fallback?: string): string | undefined {
	const value = config.options[key];
	if (value === undefined) return fallback;
	if (typeof value !== "string") throw new Error(`Destination option ${key} must be a string`);
	return value;
}

/** Read a number option, returning a fallback when it is absent. */
export function optionNumber(config: DestinationRuntimeConfig, key: string, fallback?: number): number | undefined {
	const value = config.options[key];
	if (value === undefined) return fallback;
	if (typeof value !== "number" || !Number.isFinite(value)) {
		throw new Error(`Destination option ${key} must be a finite number`);
	}

View on GitHub (pinned to 9690622007)

Solutions

  1. Add the missing option to the destination config under the exact key named in the message
  2. Validate the full config against the destination's documented option schema before starting the runtime
  3. Check for key renames after a version upgrade and migrate old config keys
  4. If the option should be optional, switch the runtime code to optionString()/optionNumber() with a fallback instead of requireOption()

Example fix

// before: config.options lacks "bucket"
const bucket = requireOption(config, "bucket");
// after: validate the whole config up front
const requiredKeys = ["bucket", "region"];
const missing = requiredKeys.filter((k) => config.options[k] === undefined);
if (missing.length) throw new Error(`Destination config missing: ${missing.join(", ")}`);
const bucket = requireOption(config, "bucket");
Defensive patterns

Strategy: validation

Validate before calling

// validate destination options before constructing the runtime
const REQUIRED = ["bucket", "region"] as const;
const missing = REQUIRED.filter((k) => config.options[k] === undefined);
if (missing.length > 0) {
  throw new Error(`destination config missing required options: ${missing.join(", ")}`);
}

Type guard

function hasOption(config: DestinationRuntimeConfig, key: string): boolean {
  return config.options[key] !== undefined;
}

Try / catch

try {
  const bucket = requireOption(config, "bucket");
} catch (err) {
  if (String(err.message).startsWith("Missing required destination option:")) {
    logger.error("destination config incomplete", { key: "bucket", providedKeys: Object.keys(config.options) });
  }
  throw err;
}

Prevention

When it happens

Trigger: Calling requireOption(config, key) — directly or via the value() helper — for a key the destination runtime needs, when the user's destination config (from the broker config JSON) omitted that option or spelled the key differently.

Common situations: User config missing a required field for an uploader destination (e.g. missing "bucket" or "region"); renamed option keys between versions so old config files no longer match; YAML/JSON typo in the key name.

Related errors


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