{"record":{"id":"ec506cb392416e72","repo":"nocobase/nocobase","slug":"flowsurfaces-fielduse-fielduse-is-not-allowed","errorCode":null,"errorMessage":"flowSurfaces fieldUse '${fieldUse}' is not allowed under '${input.containerUse}'","messagePattern":"flowSurfaces fieldUse '(.+?)' is not allowed under '(.+?)'","errorType":"validation","errorClass":"FlowSurfaceBadRequestError","httpStatus":400,"severity":"error","filePath":"packages/plugins/@nocobase/plugin-flow-engine/src/server/flow-surfaces/catalog.ts","lineNumber":3270,"sourceCode":"    KNOWN_FIELD_NODE_USES.has(input.requestedFieldUse)\n  ) {\n    throw new FlowSurfaceBadRequestError(\n      `flowSurfaces fieldUse '${input.requestedFieldUse}' does not match inferred fieldUse '${inferredFieldUse}' under '${input.containerUse}'`,\n    );\n  }\n\n  const allowedFieldUses =\n    input.requestedFieldUseMode === 'fieldType' && input.field\n      ? getSupportedFieldComponentUseSet({\n          containerUse: input.containerUse,\n          field: input.field,\n          enabledPackages: input.enabledPackages,\n          dataSourceKey: input.dataSourceKey,\n          getCollection: input.getCollection,\n        })\n      : getAllowedFieldUseSet(input.containerUse, input.enabledPackages);\n  if (!allowedFieldUses?.has(fieldUse)) {\n    throw new FlowSurfaceBadRequestError(\n      `flowSurfaces fieldUse '${fieldUse}' is not allowed under '${input.containerUse}'`,\n    );\n  }\n\n  return {\n    wrapperUse,\n    fieldUse,\n    inferredFieldUse,\n    standaloneUse: undefined,\n    renderer: requestedRenderer,\n  };\n}\n\nfunction isActionAllowedInContainer(item: FlowSurfaceCatalogItem, containerUse?: string) {\n  if (!containerUse) {\n    return true;\n  }\n  return Array.isArray(item.allowedContainerUses) && item.allowedContainerUses.includes(containerUse);","sourceCodeStart":3252,"sourceCodeEnd":3288,"githubUrl":"https://github.com/nocobase/nocobase/blob/fa42722fefe44265490dff2c27d79e2882bce4fa/packages/plugins/@nocobase/plugin-flow-engine/src/server/flow-surfaces/catalog.ts#L3252-L3288","documentation":"After resolving the effective fieldUse (requested or inferred), resolveSupportedFieldCapability (catalog.ts:3259-3273) validates it against the allowed set for the container: form allows editable uses, details/table allow display uses, filter-form allows filter uses (plus package-registered uses and, in fieldType mode, per-field component uses). A fieldUse outside that set is rejected even if it is a valid use elsewhere.","triggerScenarios":"Passing a fieldUse that belongs to a different container mode, e.g. an editable use like an input use under containerUse='table', a display use under 'form', or a filter-only use under 'details'; also a custom use from a disabled package (getRegisteredFieldUses filtered by enabledPackages).","commonSituations":"Moving/copying a field node between form, table, details, and filter-form containers without updating its use; enabling a plugin that registers field uses but not passing enabledPackages; typo in the use name so it matches no allowed set; requests built against an older catalog version.","solutions":["Use a use from the container's allowed set: editable uses under form, display uses under details/table, filter uses under filter-form.","Ensure the plugin that registers a custom field use is enabled and its use is included in enabledPackages passed to the call.","Fix the use spelling against the current flow-engine catalog (EDITABLE/DISPLAY/FILTER_FIELD_USE_SET members).","If the node was moved between containers, re-resolve its fieldUse for the new container instead of reusing the old value."],"exampleFix":"// before\nresolveSupportedFieldCapability({\n  containerUse: 'details',\n  field,\n  requestedFieldUse: 'someEditableFieldModel', // editable-only use\n});\n// after\nresolveSupportedFieldCapability({\n  containerUse: 'details',\n  field,\n  requestedFieldUse: 'someDisplayFieldModel', // display use allowed under details\n});","handlingStrategy":"validation","validationCode":"const ALLOWED_BY_CONTAINER: Record<string, Set<string>> = {\n  form: new Set(['TextInputFieldModel' /* ...all editable uses */]),\n  details: new Set([/* display uses */]),\n  table: new Set([/* display uses */]),\n  'filter-form': new Set([/* filter uses */]),\n};\nfunction fieldUseAllowed(containerUse: string, fieldUse: string, registered: Iterable<string> = []) {\n  const set = ALLOWED_BY_CONTAINER[containerUse];\n  return Boolean(set && (set.has(fieldUse) || new Set(registered).has(fieldUse)));\n}","typeGuard":"function isAllowedFieldUse(u: string, allowed: ReadonlySet<string>): boolean {\n  return allowed.has(u);\n}","tryCatchPattern":"try {\n  const cap = resolveSupportedFieldCapability(input);\n} catch (e) {\n  if (e instanceof FlowSurfaceBadRequestError && /fieldUse .* is not allowed under/.test(e.message)) {\n    // re-resolve a container-appropriate use before retrying\n    const cap = resolveSupportedFieldCapability({ ...input, requestedFieldUse: undefined });\n  } else throw e;\n}","preventionTips":["Mirror the container -> use-mode rule (form=editable, details/table=display, filter-form=filter) in client UIs and only offer valid options.","Pass enabledPackages including every plugin that registers custom field uses.","Recompute fieldUse when a node is moved between containers."],"tags":["flow-engine","validation","request-params"],"backgroundTag":"field-use-container-mismatch","analyzedSha":"fa42722fefe44265490dff2c27d79e2882bce4fa","analyzedAt":"2026-09-01T00:54:31.202Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}