can1357/oh-my-pi · error · Error
Missing or invalid field "${field}" in catalog: ${filePath}
Error message
Missing or invalid field "${field}" in catalog: ${filePath} What it means
parseMarketplaceCatalog validates required fields of a fetched marketplace.json via assertField; when a required field is missing, null, or of the wrong shape, it throws this error naming the field and the file path it was parsed from. It is the schema-validation gate for marketplace catalog files.
Source
Thrown at packages/coding-agent/src/extensibility/plugins/marketplace/fetcher.ts:90
// Rule 4: Explicit relative or home-relative paths
if (source.startsWith("./") || source.startsWith("~/")) {
return "local";
}
// Rule 5: Absolute paths — POSIX via path.isAbsolute, Windows via regex
if (path.isAbsolute(source) || WIN_ABS_RE.test(source)) {
return "local";
}
throw new Error(`Unrecognized source format. Did you mean './${source}' (local) or 'owner/repo' (GitHub)?`);
}
// ── parseMarketplaceCatalog ───────────────────────────────────────────
function assertField(condition: boolean, field: string, filePath: string): void {
if (!condition) {
throw new Error(`Missing or invalid field "${field}" in catalog: ${filePath}`);
}
}
/**
* Parse and validate a marketplace.json catalog from raw JSON content.
*
* Required fields: name (valid name segment), owner.name, plugins array.
* Each plugin entry requires name (string) and source (string or object
* with a "source" field). Extra fields are preserved via spread.
*
* @throws on JSON parse failure or missing/invalid required fields.
*/
export function parseMarketplaceCatalog(content: string, filePath: string): MarketplaceCatalog {
let raw: unknown;
try {
raw = JSON.parse(content);
} catch (err) {
throw new Error(`Failed to parse marketplace catalog at ${filePath}: ${(err as Error).message}`);View on GitHub (pinned to 9690622007)
Solutions
- Open the file named in the error and add/fix the quoted field.
- Compare against a known-good marketplace.json schema/example and match field names and types.
- Update the marketplace repo/plugin if the catalog is outdated relative to the expected schema.
- Validate the JSON parses fully and is not an error page or truncated download.
Example fix
// before (marketplace.json)
{ "plugins": [ { "name": "a", "source": "acme/a" } ] }
// after (assuming "name" was the missing field)
{ "name": "acme-marketplace", "plugins": [ { "name": "a", "source": "acme/a" } ] } Defensive patterns
Strategy: validation
Validate before calling
function validateCatalog(json: unknown): void {
const c = json as Record<string, unknown>;
if (typeof c.name !== "string" || c.name.length === 0) throw new Error("catalog.name required");
if (!Array.isArray(c.plugins)) throw new Error("catalog.plugins must be an array");
for (const p of c.plugins) {
const e = p as Record<string, unknown>;
if (typeof e.name !== "string" || typeof e.source !== "string") {
throw new Error("each plugin needs name and source");
}
}
} Type guard
function isCatalog(v: unknown): v is { name: string; plugins: { name: string; source: string }[] } {
if (typeof v !== "object" || v === null) return false;
const c = v as Record<string, unknown>;
return typeof c.name === "string" && Array.isArray(c.plugins);
} Try / catch
try {
const result = await fetchMarketplace(source);
} catch (err) {
const m = err instanceof Error && err.message.match(/Missing or invalid field "([^"]+)" in catalog: (.*)/);
if (m) {
console.error(`Fix field "${m[1]}" in ${m[2]}`);
} else throw err;
} Prevention
- Validate marketplace.json against the catalog schema before publishing/serving
- Keep local catalogs in sync with the current expected schema
- Fetch catalogs over reliable URLs and verify the response is JSON, not an error page
- Test custom marketplaces with the parser before distributing them
When it happens
Trigger: Fetching a marketplace.json that lacks required fields (e.g. name, plugins array) or has wrong types; pointing a marketplace source at the wrong JSON file; a catalog from an older/different schema version; truncated or hand-edited catalog JSON.
Common situations: Upstream marketplace repo restructured its catalog; user created a local marketplace.json missing required keys; typo in field name (case-sensitive); serving an HTML error page saved as .json that happens to parse partially.
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
- Marketplace catalog at ${filePath} must be a JSON object
- OMP_AUTH_BROKER_ACCOUNT_POOL_FILE contains an empty provider
- OMP_AUTH_BROKER_ACCOUNT_POOL_FILE contains a provider id wit
- anthropic-messages: ${data.summary}
- Schema contains a circular object graph — cannot enforce str
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/e45e40aad131dccd.
Report an issue: GitHub.