{"record":{"id":"1513299c18b69127","repo":"langgenius/dify","slug":"usage-invalid-flag","errorCode":"usage_invalid_flag","errorMessage":"invalid --role \"${opts.role}\"","messagePattern":"invalid --role \"(.+?)\"","errorType":"error_code","errorClass":"BaseError","httpStatus":null,"severity":"error","filePath":"cli/src/commands/create/member/run.ts","lineNumber":47,"sourceCode":"  readonly data: InviteOutput\n  readonly workspaceId: string\n}\n\n// `owner` is intentionally absent — ownership transfer is console-only.\nconst ASSIGNABLE_ROLES = new Set(['normal', 'admin'])\n\nexport async function runCreateMember(\n  opts: CreateMemberOptions,\n  deps: CreateMemberDeps,\n): Promise<CreateMemberResult> {\n  if (opts.email === undefined || opts.email === '') {\n    throw new BaseError({\n      code: ErrorCode.UsageMissingArg,\n      message: '--email is required',\n    })\n  }\n  if (!ASSIGNABLE_ROLES.has(opts.role)) {\n    throw new BaseError({\n      code: ErrorCode.UsageInvalidFlag,\n      message: `invalid --role \"${opts.role}\"`,\n      hint: 'expected: normal | admin (ownership transfer is console-only)',\n    })\n  }\n\n  const env = deps.envLookup ?? ((k: string) => process.env[k])\n  const factory = deps.membersFactory ?? ((h: HttpClient) => new MembersClient(h))\n  const io = deps.io ?? nullStreams()\n  const cs = colorScheme(colorEnabled(io.isErrTTY))\n\n  const wsId = resolveWorkspaceId({\n    flag: opts.workspace,\n    env: env('DIFY_WORKSPACE_ID'),\n    active: deps.active,\n  })\n\n  const response = await runWithSpinner({ io, label: `Inviting ${opts.email}` }, () =>","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/langgenius/dify/blob/ef8544b173fd6cd7a8e71df2cab576e52bebbfbc/cli/src/commands/create/member/run.ts#L29-L65","documentation":"Raised by RagPipelineVariableApi.get (GET /rag/pipelines/{pipeline_id}/workflows/draft/variables/{variable_id}) when WorkflowDraftVariableService.get_variable returns None for variable_id. The variable genuinely does not exist. NotFoundError (from controllers.common.errors) maps to HTTP 404.","triggerScenarios":"GET /console/api/rag/pipelines/{pipeline_id}/workflows/draft/variables/{variable_id} where the variable was deleted, never existed, or variable_id is a valid UUID with no matching row.","commonSituations":"Stale variable_id cached in the UI after the variable was removed; user navigates to a deep link for a deleted variable; concurrent deletion by another session.","solutions":["List variables via GET /rag/pipelines/{pipeline_id}/workflows/draft/variables and use an id from the result.","On the client, treat 404 as 'variable gone' and refresh the variable list.","Avoid persisting variable_ids in long-lived deep links; re-resolve them from the collection endpoint."],"exampleFix":"// before\nconst v = await get(`/rag/pipelines/${pipelineId}/workflows/draft/variables/${staleVarId}`);\n// after\nconst { items } = await get(`/rag/pipelines/${pipelineId}/workflows/draft/variables`).then(r => r.json());\nconst v = items.find(x => x.id === varId) ?? null;\nif (!v) { await reloadVariables(); return; }","handlingStrategy":"validation","validationCode":"async function variableExists(client, pipelineId: string, variableId: string): Promise<boolean> {\n  const r = await client.get(`/console/api/rag/pipelines/${pipelineId}/workflows/draft/variables`);\n  const { items = [] } = await r.json();\n  return items.some(v => v.id === variableId);\n}","typeGuard":"function isKnownVariableId(id: string, known: Set<string>): boolean { return known.has(id); }","tryCatchPattern":"try {\n  return await client.get(`/rag/pipelines/${pipelineId}/workflows/draft/variables/${variableId}`);\n} catch (e) {\n  if (e.response?.status === 404) { await reloadVariables(pipelineId); return null; }\n  throw e;\n}","preventionTips":["List variables under the pipeline before referencing an id.","Re-resolve variable_ids after any workflow reset or pipeline switch.","Treat 404 as 'variable gone' and refresh."],"tags":["rag-pipeline","workflow","variables","not-found","rest-api","console"],"backgroundTag":null,"analyzedSha":"ef8544b173fd6cd7a8e71df2cab576e52bebbfbc","analyzedAt":"2026-08-12T05:15:17.394Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}