{"record":{"id":"ce053e606132a92c","repo":"medusajs/medusa","slug":"cannot-set-value-value-for-columnname","errorCode":null,"errorMessage":"Cannot set value ${value} for ${columnName}.","messagePattern":"Cannot set value (.+?) for (.+?)\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/utils/src/dal/mikro-orm/big-number-field.ts","lineNumber":58,"sourceCode":"            this.__helper.__data[columnName] = undefined\n            this.__helper.__data[rawColumnName] = undefined\n            this[rawColumnName] = undefined\n          } else {\n            let bigNumber: BigNumber\n\n            try {\n              if (value instanceof BigNumber) {\n                bigNumber = value\n              } else if (this[rawColumnName]) {\n                const precision = this[rawColumnName].precision\n                bigNumber = new BigNumber(value, {\n                  precision,\n                })\n              } else {\n                bigNumber = new BigNumber(value)\n              }\n            } catch (e) {\n              throw new Error(`Cannot set value ${value} for ${columnName}.`)\n            }\n\n            const raw = bigNumber.raw!\n            raw.value = trimZeros(raw.value as string)\n\n            // Note: this.__helper isn't present when directly working with the entity\n            // Adding this in optionally for it not to break.\n            if (isDefined(this.__helper)) {\n              this.__helper.__data[columnName] = bigNumber.numeric\n              this.__helper.__data[rawColumnName] = raw\n            }\n\n            this[rawColumnName] = raw\n          }\n        }\n\n        // Note: this.__helper isn't present when directly working with the entity\n        // Adding this in optionally for it not to break.","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/medusajs/medusa/blob/5e06e544a296b9033f20f71f11c559f81a0e5739/packages/core/utils/src/dal/mikro-orm/big-number-field.ts#L40-L76","documentation":"A mikro-orm property decorator for BigNumber-typed columns. When constructing BigNumber from the incoming value throws (unparseable string, NaN, invalid object), the catch rethrows with the offending value and column name.","triggerScenarios":"Assigning a string like \"12,00\" or \"abc\" to a raw_amount/money field, or NaN from a computed price, when persisting entities via upsert/upsertWithReplace in product/order/pricing modules.","commonSituations":"CSV/product imports with locale-formatted numbers, JSON payloads using strings with currency symbols, or arithmetic producing NaN before assignment.","solutions":["Sanitize numeric strings before assignment (strip commas/symbols, validate with a regex)","Coerce to number and check Number.isFinite before setting the field","Fix the data producer to send plain numbers or plain numeric strings"],"exampleFix":"// before\nvariant.prices.push({ amount: \"1.299,00\", currency_code: \"eur\" })\n// after\nconst amount = Number(priceRaw.replace(/[^0-9.-]/g, \"\"))\nif (!Number.isFinite(amount)) throw new Error(`Bad price: ${priceRaw}`)\nvariant.prices.push({ amount, currency_code: \"eur\" })","handlingStrategy":"validation","validationCode":"const n = typeof v === 'number' ? v : Number(String(v).replace(/[^0-9.\\-]/g, ''))\nif (!Number.isFinite(n)) throw new Error(`non-numeric amount: ${v}`)","typeGuard":"const isFiniteNumber = (v: unknown): v is number => typeof v === 'number' && Number.isFinite(v)","tryCatchPattern":"try { await manager.persistAndFlush(entity) } catch (e) { if (/Cannot set value/.test(e.message)) sanitize the offending field and retry once; else throw e }","preventionTips":["Strip locale separators from imported numeric strings","Assert Number.isFinite on computed prices before assignment"],"tags":["bignumber","mikro-orm","data","validation"],"backgroundTag":"invalid-numeric-value","analyzedSha":"5e06e544a296b9033f20f71f11c559f81a0e5739","analyzedAt":"2026-08-27T07:24:39.599Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}