{"record":{"id":"afe867be082be59c","repo":"langgenius/dify","slug":"usage-missing-arg-afe867","errorCode":"usage_missing_arg","errorMessage":"specify a device label / id, or pass --all","messagePattern":"specify a device label / id, or pass --all","errorType":"error_code","errorClass":"BaseError","httpStatus":null,"severity":"error","filePath":"cli/src/commands/auth/devices/_shared/devices.ts","lineNumber":83,"sourceCode":"  }\n  return out\n}\n\nexport type DevicesRevokeOptions = {\n  readonly io: IOStreams\n  readonly reg: Registry\n  readonly active: ActiveContext\n  readonly store: TokenStore\n  readonly http: HttpClient\n  readonly target?: string\n  readonly all: boolean\n  readonly yes?: boolean\n}\n\nexport async function runDevicesRevoke(opts: DevicesRevokeOptions): Promise<void> {\n  const cs = colorScheme(colorEnabled(opts.io.isErrTTY))\n  if (!opts.all && (opts.target === undefined || opts.target === '')) {\n    throw new BaseError({\n      code: ErrorCode.UsageMissingArg,\n      message: 'specify a device label / id, or pass --all',\n      hint: \"see 'difyctl auth devices list'\",\n    })\n  }\n\n  const sessions = new AccountSessionsClient(opts.http)\n  const rows = await listAllSessions(sessions)\n  const { ids, selfHit } = pickTargets(rows, opts, opts.active.ctx.token_id ?? '')\n  if (ids.length === 0) {\n    opts.io.out.write('no sessions to revoke\\n')\n    return\n  }\n\n  if (opts.yes !== true && opts.io.isErrTTY) {\n    const confirmed = await promptConfirm(opts.io, `Revoke ${ids.length} session(s)? [y/N] `)\n    if (!confirmed) {\n      throw new BaseError({","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/langgenius/dify/blob/ef8544b173fd6cd7a8e71df2cab576e52bebbfbc/cli/src/commands/auth/devices/_shared/devices.ts#L65-L101","documentation":"Raised by DatasetMetadataBuiltInFieldActionApi.post (POST /datasets/{dataset_id}/metadata/built-in/{action}) when DatasetService.get_dataset returns None. Note this lookup is by id only (NOT tenant-scoped), so a cross-tenant dataset row that exists would pass this check and only later be filtered by check_dataset_permission. action must be 'enable' or 'disable'. Maps to HTTP 404.","triggerScenarios":"POST /console/api/datasets/{dataset_id}/metadata/built-in/enable (or disable) with a dataset_id that has no row at all. The action path parameter is validated by the Literal type only on the matched route, so an invalid action yields a routing/422 error, not this 404.","commonSituations":"Stale dataset_id after deletion; enabling/disabling built-in metadata fields on a dataset whose ID was hardcoded in a script that has drifted from the live data.","solutions":["Verify the dataset exists via GET /datasets/{dataset_id} before toggling built-in fields.","Refresh the dataset list to obtain a current ID.","Guard the client so a 404 disables the toggle UI instead of retrying."],"exampleFix":"// before\nawait post(`/datasets/${datasetId}/metadata/built-in/enable`);\n// after\nif (!(await get(`/datasets/${datasetId}`)).ok) { notify('Dataset missing'); return; }\nawait post(`/datasets/${datasetId}/metadata/built-in/enable`);","handlingStrategy":"validation","validationCode":"if (!(await datasetExists(client, datasetId))) {\n  throw new Error(`Cannot toggle built-in field: dataset ${datasetId} missing`);\n}","typeGuard":"type BuiltInAction = 'enable' | 'disable';\nfunction isBuiltInAction(a: string): a is BuiltInAction { return a === 'enable' || a === 'disable'; }","tryCatchPattern":"try {\n  await client.post(`/datasets/${datasetId}/metadata/built-in/${action}`);\n} catch (e) {\n  if (e.response?.status === 404) { await refreshDatasetList(); return; }\n  throw e;\n}","preventionTips":["Validate the dataset exists before toggling built-in fields.","Note this endpoint uses id-only lookup; tenant scoping is enforced later by check_dataset_permission.","Disable the toggle UI on 404 rather than retrying."],"tags":["dataset","metadata","built-in","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"}