{"record":{"id":"eeb7ec0e621d9eb8","repo":"BloopAI/vibe-kanban","slug":"failed-to-update-mutation-name-or-server-provi","errorCode":null,"errorMessage":"Failed to update ${mutation.name} (or server-provided message via parseResponseError)","messagePattern":"Failed to update (.+?) \\(or server-provided message via parseResponseError\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/web-core/src/shared/lib/electric/collections.ts","lineNumber":711,"sourceCode":"        const mutationItem = transaction.mutations[0];\n        if (!mutationItem?.key) {\n          throw new Error(`Failed to update ${mutation.name}: missing key`);\n        }\n\n        const response = await makeRequest(\n          `${mutation.url}/${mutationItem.key}`,\n          {\n            method: 'PATCH',\n            body: JSON.stringify(mutationItem.changes),\n          }\n        );\n\n        if (!response.ok) {\n          const message = await parseResponseError(\n            response,\n            `Failed to update ${mutation.name}`\n          );\n          throw new Error(message);\n        }\n\n        const result = (await response.json()) as { txid: number };\n        txids = [result.txid];\n      }\n\n      maybeRefreshFallbackAfterMutation(sourceKey);\n\n      if (isSourceFallbackLocked(sourceKey)) {\n        return;\n      }\n\n      return { txid: txids };\n    },\n\n    onDelete: async ({\n      transaction,\n    }: MutationFnParams): Promise<{ txid: number[] } | void> => {","sourceCodeStart":693,"sourceCodeEnd":729,"githubUrl":"https://github.com/BloopAI/vibe-kanban/blob/4deb7eca8f381f7cbc1f9d15515a9ab8f8009053/packages/web-core/src/shared/lib/electric/collections.ts#L693-L729","documentation":"Thrown in the ElectricSQL collection onUpdate mutation handler when the PATCH request to `${mutation.url}/{key}` returns a non-ok HTTP status. It surfaces either the server-provided error message extracted by parseResponseError or the fallback 'Failed to update <name>'. This is the optimistic-update write path failing at the API layer, so the local mutation cannot be confirmed with a txid.","triggerScenarios":"Any non-2xx response from the PATCH to the collection's REST endpoint: 400 on invalid changes payload, 401/403 on auth failure, 404 when the record key no longer exists, 409/422 on validation or conflict, 5xx on backend crash.","commonSituations":"Editing a task that another session deleted (404); submitting fields that violate backend validation; an expired session token; the backend restarting mid-edit.","solutions":["Read the thrown message: if it contains a server message, fix the payload/validation issue it names; if it's the fallback, inspect the network tab for the actual status code of the PATCH request.","If 401/403, re-authenticate so the request carries a valid bearer token/session cookie, then retry the mutation.","If 404, refresh the collection so the deleted item disappears locally instead of retrying the PATCH.","If 5xx, check backend logs/health and retry once the server recovers; the Electric collection will retry pending mutations on reconnect."],"exampleFix":"// before: blind retry of a failing PATCH\nawait collection.update(item, { changes });\n// after: guard with up-to-date data and handle failure\nconst fresh = await fetch(`${mutation.url}/${item.id}`);\nif (!fresh.ok) {\n  await collection.refetch(); // record gone/stale, resync instead of PATCH\n  return;\n}\nawait collection.update(item, { changes });","handlingStrategy":"try-catch","validationCode":"const res = await fetch(`${mutation.url}/${item.id}`, { method: 'HEAD' });\nif (!res.ok) throw new Error(`Record ${item.id} not updatable (HTTP ${res.status})`);","typeGuard":null,"tryCatchPattern":"try {\n  await collection.update(item, { changes });\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('Failed to update')) {\n    console.error('Update rejected:', e.message);\n    await collection.refetch();\n  } else throw e;\n}","preventionTips":["Refresh the collection before editing long-lived pages so keys still exist server-side","Keep sessions alive / re-authenticate before bulk edit operations","Log the failing PATCH's status code alongside the thrown message for diagnosis","Validate form input against backend schema before submitting the mutation"],"tags":["http","network","electric-sql","optimistic-mutations"],"backgroundTag":"http-request-failed","analyzedSha":"4deb7eca8f381f7cbc1f9d15515a9ab8f8009053","analyzedAt":"2026-08-29T09:24:13.446Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}