{"record":{"id":"1995bfb5052c66e4","repo":"nocobase/nocobase","slug":"unsupported-unset-field-field-supported-fi","errorCode":null,"errorMessage":"Unsupported --unset field \"${field}\". Supported fields: ${Array.from(UNSETTABLE_FIELDS).sort().join(', ')}.","messagePattern":"Unsupported --unset field \"(.+?)\"\\. Supported fields: (.+?)\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/core/cli/src/commands/env/update.ts","lineNumber":196,"sourceCode":"\n  for (const field of UPDATE_BOOLEAN_FLAGS) {\n    if (flags[field] !== undefined) {\n      fields.add(field);\n    }\n  }\n\n  return fields;\n}\n\nfunction normalizeUnsetFields(unset: string[] | undefined): string[] {\n  const normalized = (unset ?? [])\n    .flatMap((value) => value.split(','))\n    .map((value) => value.trim())\n    .filter(Boolean);\n\n  for (const field of normalized) {\n    if (!UNSETTABLE_FIELDS.has(field)) {\n      throw new Error(\n        `Unsupported --unset field \"${field}\". Supported fields: ${Array.from(UNSETTABLE_FIELDS).sort().join(', ')}.`,\n      );\n    }\n  }\n\n  return Array.from(new Set(normalized));\n}\n\nfunction buildCurrentConfigInput(\n  env: NonNullable<Awaited<ReturnType<typeof getEnv>>>,\n): StoredEnvConfigInput & Record<string, unknown> {\n  return {\n    ...env.config,\n    apiBaseUrl: env.apiBaseUrl,\n    authType: env.authType,\n    authUsername: env.config.authUsername,\n    accessToken: env.auth?.type === 'token' ? env.auth.accessToken : undefined,\n  };","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/nocobase/nocobase/blob/fa42722fefe44265490dff2c27d79e2882bce4fa/packages/core/cli/src/commands/env/update.ts#L178-L214","documentation":"`nb env update --unset <field>` only accepts a fixed set of unsettable fields (UNSETTABLE_FIELDS: special fields like api-base-url/auth-type/access-token/username plus all string and boolean config flags). normalizeUnsetFields rejects anything else with this error, listing the supported fields sorted. Comma-separated values are split and each element is checked individually.","triggerScenarios":"Running `nb env update --env <env> --unset <field>` where field (or any item in a comma-separated list) is not in UNSETTABLE_FIELDS — e.g. `--unset db-password,typo-field`, deprecated flag names, or fields that never existed.","commonSituations":"Typos in field names (`--unset dbhosst`); trying to unset a field added in a newer CLI than the one installed (or removed in an upgrade); passing spaces or wrong casing; assuming read-only fields like env name can be unset.","solutions":["Copy field names exactly from the error's `Supported fields:` list (or `nb env update --help`)","If you used a comma list, check each item individually — one bad item rejects the whole call","Upgrade the CLI if the field you need is missing (`npm i -g @nocobase/cli`) — older versions have a smaller UNSETTABLE_FIELDS set","To change rather than clear a field, pass `--<field> <value>` instead of --unset"],"exampleFix":"// before\nnb env update --env prod --unset dbhosst\n// error: Unsupported --unset field \"dbhosst\"\n// after\nnb env update --env prod --unset db-host","handlingStrategy":"validation","validationCode":"// Pre-validate --unset fields against the documented set:\nconst UNSETTABLE = new Set(['api-base-url','auth-type','access-token','username','source','download-version','docker-registry','docker-platform','git-url','npm-registry','app-path','app-root-path','storage-path','app-public-path','cdn-base-url','env-file','app-port','app-key','timezone','db-dialect','builtin-db-image','db-host','db-port','db-database','db-user','db-password','db-schema','db-table-prefix','builtin-db','dev-dependencies','build','build-dts','db-underscored']);\nfields.forEach(f => { if (!UNSETTABLE.has(f)) throw new Error(`bad --unset field: ${f}`); });","typeGuard":null,"tryCatchPattern":"try {\n  await nb(['env','update','--env',env,'--unset',fields.join(',')]);\n} catch (err) {\n  if (/Unsupported --unset field/.test(err.message)) {\n    console.error('Valid fields are listed in the error; fix and retry.');\n  }\n  throw err;\n}","preventionTips":["Copy field names from the CLI help or the error's Supported fields list, never from memory","When unsetting multiple fields, test each name individually first","After CLI upgrades, re-check that the fields you script still exist","Use --unset for clearing values and --<field> <value> for changing them"],"tags":["cli","env","validation","flags"],"backgroundTag":"unsupported-field-name","analyzedSha":"fa42722fefe44265490dff2c27d79e2882bce4fa","analyzedAt":"2026-09-01T00:54:31.202Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}