{"record":{"id":"6ff51540768e732e","repo":"FlowiseAI/Flowise","slug":"error-inserting-res-error-message-res-status","errorCode":null,"errorMessage":"Error inserting: ${res.error.message} ${res.status} ${res.statusText}","messagePattern":"Error inserting: (.+?) (.+?) (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/vectorstores/Supabase/Supabase.ts","lineNumber":286,"sourceCode":"                }\n                return row\n            })\n\n            let res = await this.client.from(this.tableName).upsert(chunk).select()\n\n            if (res.error) {\n                // If the error is due to null value in column \"id\", we will generate a new id for the row\n                if (res.error.message.includes(`null value in column \"id\"`)) {\n                    const chunk = rows.slice(i, i + this.upsertBatchSize).map((row, y) => {\n                        if (options?.ids) {\n                            return { id: options.ids[i + y], ...row }\n                        }\n                        return { id: uuidv4(), ...row }\n                    })\n                    res = await this.client.from(this.tableName).upsert(chunk).select()\n\n                    if (res.error) {\n                        throw new Error(`Error inserting: ${res.error.message} ${res.status} ${res.statusText}`)\n                    }\n                } else {\n                    throw new Error(`Error inserting: ${res.error.message} ${res.status} ${res.statusText}`)\n                }\n            }\n\n            if (res.data) {\n                returnedIds = returnedIds.concat(res.data.map((row) => row.id))\n            }\n        }\n\n        return returnedIds\n    }\n}\n\nmodule.exports = { nodeClass: Supabase_VectorStores }\n","sourceCodeStart":268,"sourceCodeEnd":303,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/vectorstores/Supabase/Supabase.ts#L268-L303","documentation":"In `SupabaseUpsertVectorStore.addVectors`, after the first upsert fails with a `null value in column \"id\"` error, the code regenerates ids (using provided ids or uuidv4) and retries the upsert in batches. This error is thrown when that retry ALSO fails, meaning the failure is not merely a missing id but a deeper schema/policy/dimension problem. The message concatenates the Supabase error message, HTTP status, and status text.","triggerScenarios":"RLS policy denying insert even with an id; vector/embedding column type or dimension mismatch; NOT NULL constraint on another column; unique constraint violation on retry; the table schema changed after the null-id fix path was taken.","commonSituations":"Service role not used so RLS blocks the retry; embedding model swapped (dimension mismatch vs the `vector(N)` column); a required metadata column added without default; concurrent upserts hitting a unique constraint.","solutions":["Use the service role key to bypass RLS during ingestion.","Align the embedding dimension with the table's `vector(N)` column.","Inspect `res.error.message`/`res.status` in the wrapped text to identify the constraint/policy.","Add defaults or supply values for any other NOT NULL columns; ensure no unique-constraint collisions on retry."],"exampleFix":"// before\nres = await this.client.from(this.tableName).upsert(chunk).select()\nif (res.error) throw new Error(`Error inserting: ${res.error.message} ${res.status} ${res.statusText}`)\n\n// after (structured error)\nres = await this.client.from(this.tableName).upsert(chunk).select()\nif (res.error) {\n  const err = new Error(`Supabase upsert failed: ${res.error.message} (${res.status} ${res.statusText})`)\n  ;(err as any).status = res.status; (err as any).code = res.error.code\n  throw err\n}","handlingStrategy":"validation","validationCode":"function assertSupabaseUpsertReady(client: any, tableName: string, embeddingDim: number) {\n  // before bulk upsert, verify table + vector dim + RLS bypass\n  if (!tableName) throw new Error('tableName required')\n  if (!Number.isFinite(embeddingDim) || embeddingDim <= 0) throw new Error('embedding dim must be positive')\n}","typeGuard":"null","tryCatchPattern":"res = await this.client.from(this.tableName).upsert(chunk).select()\nif (res.error) { const e = new Error(`Supabase upsert retry failed: ${res.error.message} (${res.status})`); (e as any).status = res.status; throw e }","preventionTips":["Use the service role key so RLS does not block the retry.","Keep embedding dim == vector(N) column.","Supply ids explicitly to avoid the null-id retry path.","Surface res.error.code/status for diagnosis."],"tags":["supabase","upsert","rls","schema","vectorstore","typescript"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}