{"record":{"id":"0349419045b45c1b","repo":"langgenius/dify","slug":"usageinvalidflag-034941","errorCode":"UsageInvalidFlag","errorMessage":"workflow apps do not accept a positional message","messagePattern":"workflow apps do not accept a positional message","errorType":"error_code","errorClass":"BaseError","httpStatus":null,"severity":"error","filePath":"cli/src/commands/run/app/run.ts","lineNumber":71,"sourceCode":"      throw err.withHint(\n        'app metadata cache cleared — if the app was recently republished, run the command again',\n      )\n    }\n    throw err\n  }\n}\n\nasync function executeRun(\n  opts: RunAppOptions,\n  deps: RunAppDeps,\n  meta: AppMetaClient,\n): Promise<void> {\n  const m = await meta.get(opts.appId, [FieldInfo])\n  const mode = m.info?.mode ?? ''\n  if (mode === '') throw new Error(`app ${opts.appId}: mode missing from app metadata`)\n\n  if (mode === RUN_MODES.Workflow && opts.message !== undefined && opts.message !== '') {\n    throw new BaseError({\n      code: ErrorCode.UsageInvalidFlag,\n      message: 'workflow apps do not accept a positional message',\n      hint: 'pass workflow inputs via --inputs \\'{\"key\":\"value\"}\\'',\n    })\n  }\n\n  const inputs = await resolveInputs(opts.inputsJson, opts.inputsFile, opts.inputs)\n  if (opts.files !== undefined && opts.files.length > 0) {\n    const uploadClient = new FileUploadClient(deps.http)\n    const fileInputs = await resolveFileInputs(opts.appId, opts.files, (appId, path) =>\n      uploadClient.upload(appId, path),\n    )\n    Object.assign(inputs, fileInputs)\n  }\n  const format = opts.format ?? ''\n  const isText = TEXT_FORMATS.has(format)\n  const livePrint = opts.stream === true\n  const runClient = new AppRunClient(deps.http)","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/langgenius/dify/blob/ef8544b173fd6cd7a8e71df2cab576e52bebbfbc/cli/src/commands/run/app/run.ts#L53-L89","documentation":"Thrown by `executeRun` (run/app/run.ts:71) when the resolved app mode is `Workflow` and a positional `message` argument was also supplied (`opts.message` is a non-empty string). Workflow apps take structured `inputs`, not a free-text message, so combining them is rejected as `usage_invalid_flag` (exit 2) with a hint pointing to `--inputs`.","triggerScenarios":"Running `difyctl run app <workflow-uuid> \"hello\"` or `--message \"hello\"` against an app whose metadata `mode === 'workflow'`. The guard at line 70 checks mode and non-empty message.","commonSituations":"User reuses a chat/completion invocation pattern on a workflow app; misidentifies the app type; scripting template assumes a message arg uniformly.","solutions":["Drop the positional message and pass workflow inputs via `--inputs '{\"key\":\"value\"}'`.","Confirm the app type with `difyctl describe app <uuid>`; if it should accept a message, it is not a workflow app.","Update scripts to branch on app mode before choosing message vs inputs."],"exampleFix":"// before\n$ difyctl run app <workflow-uuid> \"summarize this\"\n// after\n$ difyctl run app <workflow-uuid> --inputs '{\"text\":\"summarize this\"}'","handlingStrategy":"validation","validationCode":"// Resolve mode first; only pass a message for non-workflow apps.\nconst mode = await getAppMode(appId)\nif (mode === 'workflow' && opts.message) {\n  throw new Error('workflow apps take --inputs, not a message')\n}","typeGuard":"function isWorkflowMode(mode: string): boolean {\n  return mode === 'workflow'\n}","tryCatchPattern":null,"preventionTips":["Branch invocation logic on app mode: workflow → `--inputs`, chat/completion → message.","Confirm the app type with `difyctl describe app <uuid>` before scripting.","Never combine a positional message with workflow inputs."],"tags":["cli","workflow","inputs","flag-parsing","difyctl","typescript"],"backgroundTag":null,"analyzedSha":"ef8544b173fd6cd7a8e71df2cab576e52bebbfbc","analyzedAt":"2026-08-12T05:15:17.394Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}