langgenius/dify · error · BaseError
usage_missing_arg
usage_missing_arg
Error message
member id is required
What it means
Raised by RagPipelineVariableApi.get when the variable exists (get_variable returned a row) but its variable.app_id does not equal pipeline.id — i.e. the variable belongs to a different pipeline. The same 'variable not found' message is deliberately reused to avoid leaking the existence of a variable owned by another pipeline (an authorization-vs-existence blending). Maps to HTTP 404.
Source
Thrown at cli/src/commands/delete/member/run.ts:39
export type DeleteMemberDeps = {
readonly active: ActiveContext
readonly http: HttpClient
readonly io?: IOStreams
readonly envLookup?: (k: string) => string | undefined
readonly membersFactory?: (http: HttpClient) => MembersClient
}
export type DeleteMemberResult = {
readonly data: DeleteMemberOutput
readonly workspaceId: string
}
export async function runDeleteMember(
opts: DeleteMemberOptions,
deps: DeleteMemberDeps,
): Promise<DeleteMemberResult> {
if (opts.memberId === undefined || opts.memberId === '') {
throw new BaseError({
code: ErrorCode.UsageMissingArg,
message: 'member id is required',
hint: 'pass it positionally: difyctl delete member <member-id>',
})
}
const env = deps.envLookup ?? ((k: string) => process.env[k])
const factory = deps.membersFactory ?? ((h: HttpClient) => new MembersClient(h))
const io = deps.io ?? nullStreams()
const cs = colorScheme(colorEnabled(io.isErrTTY))
const wsId = resolveWorkspaceId({
flag: opts.workspace,
env: env('DIFY_WORKSPACE_ID'),
active: deps.active,
})
if (!opts.yes && io.isErrTTY) {View on GitHub (pinned to ef8544b173)
Solutions
- Ensure the variable_id was obtained from the same pipeline_id (list variables under the target pipeline first).
- When switching pipelines in the UI, clear cached variable_ids.
- Treat the 404 identically to a missing variable: re-list variables under the current pipeline.
Example fix
// before — variableId belongs to pipeline A, called against pipeline B
await get(`/rag/pipelines/${pipelineB}/workflows/draft/variables/${varFromA}`);
// after
const { items } = await get(`/rag/pipelines/${pipelineB}/workflows/draft/variables`).then(r => r.json());
const local = items.find(x => x.id === varId);
if (!local) { notify('Variable not in this pipeline'); return; } Defensive patterns
Strategy: validation
Validate before calling
async function variableBelongsToPipeline(client, pipelineId: string, variableId: string): Promise<boolean> {
const r = await client.get(`/console/api/rag/pipelines/${pipelineId}/workflows/draft/variables`);
const { items = [] } = await r.json();
return items.some(v => v.id === variableId);
}
if (!(await variableBelongsToPipeline(client, pipelineId, variableId))) {
throw new Error(`variable ${variableId} not in pipeline ${pipelineId}`);
} Type guard
function isVariableInPipeline(variable: { app_id?: string }, pipelineId: string): boolean {
return variable?.app_id === pipelineId;
} Try / catch
try {
return await client.get(`/rag/pipelines/${pipelineId}/workflows/draft/variables/${variableId}`);
} catch (e) {
if (e.response?.status === 404) {
// could be missing OR owned by another pipeline — re-list under this pipeline
await reloadVariables(pipelineId);
return null;
}
throw e;
} Prevention
- Always obtain variable_id from the same pipeline's variable list.
- Clear cached variable_ids when switching pipelines.
- Recognize that the same 404 message covers missing and cross-pipeline cases by design.
When it happens
Trigger: GET /console/api/rag/pipelines/{pipeline_id}/workflows/draft/variables/{variable_id} where variable_id exists but is owned by a different pipeline. Happens when a variable_id from pipeline A is sent under the URL of pipeline B — e.g. copy-paste across pipelines, or a client that reuses a variable_id after the user switched pipelines.
Common situations: User switched pipelines in the UI but the deep link still carries a variable_id from the previous pipeline; automation script hardcoded a variable_id while targeting a different pipeline; pipeline was duplicated and the client reused the source pipeline's variable_id against the copy.
Related errors
AI-assisted analysis of langgenius/dify@ef8544b173 (2026-08-12).
Data as JSON: /api/errors/57c7dfc2c9a51fe2.
Report an issue: GitHub.