{"record":{"id":"a5d9b44d094e68fb","repo":"openai/codex-plugin-cc","slug":"missing-required-endpoint","errorCode":null,"errorMessage":"Missing required --endpoint.","messagePattern":"Missing required --endpoint\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"plugins/codex/scripts/app-server-broker.mjs","lineNumber":59,"sourceCode":"  if (!pidFile) {\n    return;\n  }\n  fs.mkdirSync(path.dirname(pidFile), { recursive: true });\n  fs.writeFileSync(pidFile, `${process.pid}\\n`, \"utf8\");\n}\n\nasync function main() {\n  const [subcommand, ...argv] = process.argv.slice(2);\n  if (subcommand !== \"serve\") {\n    throw new Error(\"Usage: node scripts/app-server-broker.mjs serve --endpoint <value> [--cwd <path>] [--pid-file <path>]\");\n  }\n\n  const { options } = parseArgs(argv, {\n    valueOptions: [\"cwd\", \"pid-file\", \"endpoint\"]\n  });\n\n  if (!options.endpoint) {\n    throw new Error(\"Missing required --endpoint.\");\n  }\n\n  const cwd = options.cwd ? path.resolve(process.cwd(), options.cwd) : process.cwd();\n  const endpoint = String(options.endpoint);\n  const listenTarget = parseBrokerEndpoint(endpoint);\n  const pidFile = options[\"pid-file\"] ? path.resolve(options[\"pid-file\"]) : null;\n  writePidFile(pidFile);\n\n  const appClient = await CodexAppServerClient.connect(cwd, { disableBroker: true });\n  let activeRequestSocket = null;\n  let activeStreamSocket = null;\n  let activeStreamThreadIds = null;\n  const sockets = new Set();\n\n  function clearSocketOwnership(socket) {\n    if (activeRequestSocket === socket) {\n      activeRequestSocket = null;\n    }","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/openai/codex-plugin-cc/blob/db52e28f4d9ded852ab3942cea316258ae4ef346/plugins/codex/scripts/app-server-broker.mjs#L41-L77","documentation":"After confirming the 'serve' subcommand, the broker parses argv for value options ['cwd','pid-file','endpoint']. If --endpoint is absent or empty, the broker cannot create a listening socket (parseBrokerEndpoint needs it) so it aborts immediately before binding. The endpoint identifies the unix socket path the broker will listen on.","triggerScenarios":"Running `serve` without `--endpoint`, or passing `--endpoint` with no value if the arg parser treats it as a flag. Also if the endpoint env var is expected but the script reads only the CLI option (it does not fall back to env here).","commonSituations":"Operator forgets --endpoint when scripting broker startup, or a wrapper that conditionally sets the endpoint but the condition evaluates empty. Note this script does NOT consult CODEX_COMPANION_APP_SERVER_ENDPOINT env (that env is used by the client side in app-server.mjs).","solutions":["Provide --endpoint with a unix socket path, e.g. --endpoint unix:///tmp/codex-broker.sock.","Verify the wrapper actually interpolates the endpoint value and does not emit a bare '--endpoint' with nothing after it.","Check that no upstream quoting strips the value."],"exampleFix":"// before\nnode scripts/app-server-broker.mjs serve\n// after\nnode scripts/app-server-broker.mjs serve --endpoint unix:///tmp/codex-broker.sock","handlingStrategy":"validation","validationCode":"if (!options.endpoint) {\n  console.error('--endpoint is required');\n  process.exit(2);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass --endpoint with a concrete unix socket path.","Validate the endpoint is non-empty in the launching wrapper before exec."],"tags":["cli","usage","broker","missing-argument"],"backgroundTag":null,"analyzedSha":"db52e28f4d9ded852ab3942cea316258ae4ef346","analyzedAt":"2026-08-13T05:13:20.855Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}