{"record":{"id":"5c00b88007ab664f","repo":"jackwener/OpenCLI","slug":"command-fullname-cmd-has-no-func-or-pipeline","errorCode":null,"errorMessage":"Command ${fullName(cmd)} has no func or pipeline","messagePattern":"Command (.+?) has no func or pipeline","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"src/execution.ts","lineNumber":150,"sourceCode":"            `Failed to load adapter module ${modulePath}: ${getErrorMessage(err)}`,\n            'Check that the adapter file exists and has no syntax errors.',\n          );\n        },\n      );\n      _loadedModules.set(modulePath, loadPromise);\n    }\n    await _loadedModules.get(modulePath);\n\n    const updated = getRegistry().get(fullName(cmd));\n    if (updated?.func) {\n      return runCommandFunc(updated, page, kwargs, debug);\n    }\n    if (updated?.pipeline) return executePipeline(page, updated.pipeline, { args: kwargs, debug });\n  }\n\n  if (cmd.func) return runCommandFunc(cmd, page, kwargs, debug);\n  if (cmd.pipeline) return executePipeline(page, cmd.pipeline, { args: kwargs, debug });\n  throw new CommandExecutionError(\n    `Command ${fullName(cmd)} has no func or pipeline`,\n    'This is likely a bug in the adapter definition. Please report this issue.',\n  );\n}\n\nfunction runCommandFunc(cmd: CliCommand, page: IPage | null, kwargs: CommandArgs, debug: boolean): Promise<unknown> {\n  if (cmd.browser === false) return cmd.func!(kwargs, debug);\n  if (!page) {\n    throw new CommandExecutionError(`Command ${fullName(cmd)} requires a browser session but none was provided`);\n  }\n  return (cmd as BrowserCliCommand).func!(page, kwargs, debug);\n}\n\nfunction resolvePreNav(cmd: CliCommand): string | null {\n  if (cmd.navigateBefore === false) return null;\n  if (typeof cmd.navigateBefore === 'string') return cmd.navigateBefore;\n  // strategy → navigateBefore expansion already happened in normalizeCommand().\n  return null;","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/src/execution.ts#L132-L168","documentation":"This CommandExecutionError is thrown by runCommand when a resolved CliCommand has neither a `func` nor a `pipeline` defined, so there is nothing to execute. The library treats this as an adapter-definition bug and asks the user to report it, since a properly registered command must always implement one of the two execution paths.","triggerScenarios":"runTask or main resolves a command via kwargs and dispatches to runCommand, but the matching adapter object defines neither `func` nor `pipeline` (e.g. an adapter stub, a partially-migrated definition, or an object where both fields are undefined/removed).","commonSituations":"See trigger scenarios.","solutions":["Open the adapter definition for the failing command (printed via fullName(cmd)) and add either a `func` implementation or a `pipeline`.","If you cannot fix the adapter, report the issue to the adapter/library maintainer as the message suggests — this path is unreachable for well-formed definitions.","Verify you are loading the intended adapter set: a stub or placeholder adapter may be shadowing the real command registration.","Check for adapter/library version mismatches after upgrades and reinstall or align versions so the command resolves to a complete definition."],"exampleFix":"// before\nconst deploy: CliCommand = { name: 'deploy', description: 'Deploy the app' }; // no func/pipeline\n\n// after\nconst deploy: CliCommand = { name: 'deploy', description: 'Deploy the app', browser: false, func: async (kwargs, debug) => runDeploy(kwargs, debug) };","handlingStrategy":"type-guard","validationCode":"function isExecutableCommand(cmd) {\n  return typeof cmd === 'object' && cmd !== null && (typeof cmd.func === 'function' || cmd.pipeline != null);\n}\n// before dispatch: if (!isExecutableCommand(cmd)) throw new Error(`Command ${cmd.name} is not executable`);","typeGuard":"function hasFuncOrPipeline(cmd) {\n  return typeof (cmd as { func?: unknown }).func === 'function' || (cmd as { pipeline?: unknown }).pipeline != null;\n}","tryCatchPattern":"try {\n  await runCommand(cmd, page, kwargs, debug);\n} catch (err) {\n  if (err instanceof CommandExecutionError && /has no func or pipeline/.test(err.message)) {\n    console.error(`Adapter bug in '${cmd.name}': define func or pipeline`);\n  }\n  throw err;\n}","preventionTips":["Give every new adapter a func or pipeline before registering it.","Add a startup assertion/CI check that scans registered commands for executability.","Avoid `as CliCommand` casts that bypass type checking of func/pipeline presence.","Test each command end-to-end so unreachable definitions surface in CI, not at runtime."],"tags":["adapter-definition","cli","library-bug"],"backgroundTag":"incomplete-command-definition","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}