{"record":{"id":"e0542e22b1c8dec8","repo":"openai/codex-plugin-cc","slug":"expected-label-to-be-an-object","errorCode":null,"errorMessage":"Expected ${label} to be an object.","messagePattern":"Expected (.+?) to be an object\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/bump-version.mjs","lineNumber":130,"sourceCode":"      throw new Error(`Unexpected extra argument: ${arg}`);\n    } else {\n      options.version = arg;\n    }\n  }\n\n  options.root = path.resolve(options.root);\n  return options;\n}\n\nfunction validateVersion(version) {\n  if (!VERSION_PATTERN.test(version)) {\n    throw new Error(`Expected a semver-like version such as 1.0.3, got: ${version}`);\n  }\n}\n\nfunction requireObject(value, label) {\n  if (!value || typeof value !== \"object\" || Array.isArray(value)) {\n    throw new Error(`Expected ${label} to be an object.`);\n  }\n}\n\nfunction findMarketplacePlugin(json) {\n  const plugin = json.plugins?.find((entry) => entry?.name === \"codex\");\n  requireObject(plugin, \".claude-plugin/marketplace.json plugins[codex]\");\n  return plugin;\n}\n\nfunction readJson(root, file) {\n  const filePath = path.join(root, file);\n  return JSON.parse(fs.readFileSync(filePath, \"utf8\"));\n}\n\nfunction writeJson(root, file, json) {\n  const filePath = path.join(root, file);\n  fs.writeFileSync(filePath, `${JSON.stringify(json, null, 2)}\\n`);\n}","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/openai/codex-plugin-cc/blob/db52e28f4d9ded852ab3942cea316258ae4ef346/scripts/bump-version.mjs#L112-L148","documentation":"Thrown by requireObject() when a value that must be a JSON object is instead null, undefined, a non-object, or an array. It is a structural validator used when mutating nested manifest fields (package-lock.json's packages[\"\"], marketplace.json metadata, marketplace.json plugins[codex]). The label names exactly which field failed so the offending manifest is identifiable.","triggerScenarios":"Running bump-version against a repo whose package-lock.json lacks packages[\"\"], or marketplace.json lacks metadata, or whose plugins array has no entry with name 'codex' (findMarketplacePlugin returns undefined → requireObject fails). Reached during the write (set) path of bumpVersion or checkVersions.","commonSituations":"Regenerated package-lock.json with a different shape (older/newer npm); hand-edited marketplace.json missing the metadata block; the codex plugin entry was renamed or removed; running against a subtree that doesn't contain the full marketplace manifest.","solutions":["Inspect the manifest named in the error label and restore the missing object (e.g. add a `metadata: {}` block or a codex plugin entry).","Regenerate package-lock.json with `npm install` to restore the packages[\"\"] self-entry.","Ensure marketplace.json has both `metadata` and a plugins[] entry with name 'codex' before bumping.","Run from the correct repository root so all four target manifests are present."],"exampleFix":"// before — .claude-plugin/marketplace.json\n{ \"plugins\": [{ \"name\": \"codex\" }] } // no metadata\n\n// after\n{\n  \"metadata\": { \"version\": \"0.0.0\" },\n  \"plugins\": [{ \"name\": \"codex\", \"version\": \"0.0.0\" }]\n}","handlingStrategy":"type-guard","validationCode":"function isPlainObject(value) {\n  return value != null && typeof value === \"object\" && !Array.isArray(value);\n}\n\n// pre-flight manifest shape before bumping:\nconst ml = readJson(root, \".claude-plugin/marketplace.json\");\nif (!isPlainObject(ml.metadata)) throw new Error(\"marketplace.json missing metadata object\");\nif (!ml.plugins?.some((p) => p?.name === \"codex\")) throw new Error(\"marketplace.json missing codex plugin\");\nconst lock = readJson(root, \"package-lock.json\");\nif (!isPlainObject(lock.packages?.[\"\"])) throw new Error(\"package-lock.json missing packages[\\\"\\\"]\");","typeGuard":"function isPlainObject(value) {\n  return value != null && typeof value === \"object\" && !Array.isArray(value);\n}","tryCatchPattern":"try {\n  bumpVersion(root, version);\n} catch (err) {\n  if (/Expected .* to be an object/.test(err.message)) {\n    console.error(\"Manifest structurally invalid:\", err.message);\n    // inspect/regenerate the named file before retrying\n  } else throw err;\n}","preventionTips":["Keep manifests machine-managed (npm install) rather than hand-editing nested blocks.","Run --check before bumping to surface structural drift early.","Commit manifests together so their shapes stay consistent."],"tags":["validation","json","manifest","bump-version","structure"],"backgroundTag":null,"analyzedSha":"db52e28f4d9ded852ab3942cea316258ae4ef346","analyzedAt":"2026-08-13T05:13:20.855Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}