discourse/discourse · error · Error
[FormKit]: the @data property expects a POJO.
Error message
[FormKit]: the @data property expects a POJO.
What it means
A type-coercion guard in the FormKit changeset constructor: the @data passed to the form is not a POJO, so Immer's `produce` rejected it (message containing "[Immer]") and the original cause is rethrown wrapped. The faulty input is the non-plain-object value bound to `<form.Form @data>` (e.g. an Ember object, class instance, or undefined-derived value).
Solutions
- Pass a plain JavaScript object as @data, e.g. `{ ...model }` instead of the model instance
- Convert arrays/Map/Set or Ember proxies to POJOs before handing them to the form
- Inspect `e.cause` for the underlying Immer error if the data looks like a POJO
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at frontend/discourse/app/form-kit/lib/fk-form-data.js:51 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of discourse/discourse@1b2d7253e8 (2026-08-26).
Data as JSON: /api/errors/795367a60348a031.
Report an issue: GitHub.
Appendix: source
Thrown at frontend/discourse/app/form-kit/lib/fk-form-data.js:51
@tracked patches = [];
/**
* The inverse patches to be applied, useful for rollback.
* @type {Array}
*/
@tracked inversePatches = [];
/**
* Creates an instance of Changeset.
* @param {any} data - The initial data.
*/
constructor(data) {
try {
this.data = produce(data, () => {});
this.draftData = produce(data, () => {});
} catch (e) {
if (e.message.includes("[Immer]")) {
throw new Error("[FormKit]: the @data property expects a POJO.", {
cause: e,
});
}
}
}
/**
* Checks if the changeset is valid.
* @return {boolean} True if there are no errors.
*/
get isValid() {
return Object.keys(this.errors).length === 0;
}
/**
* Checks if the changeset is invalid.
* @return {boolean} True if there are errors.
*/View on GitHub (pinned to 1b2d7253e8)