{"record":{"id":"cd3236c45af52075","repo":"BloopAI/vibe-kanban","slug":"failed-to-delete-mutation-name-or-server-provi","errorCode":null,"errorMessage":"Failed to delete ${mutation.name} (or server-provided message via parseResponseError)","messagePattern":"Failed to delete (.+?) \\(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":744,"sourceCode":"\n    onDelete: async ({\n      transaction,\n    }: MutationFnParams): Promise<{ txid: number[] } | void> => {\n      const txids = await Promise.all(\n        transaction.mutations.map(async (mutationItem) => {\n          const response = await makeRequest(\n            `${mutation.url}/${mutationItem.key}`,\n            {\n              method: 'DELETE',\n            }\n          );\n\n          if (!response.ok) {\n            const message = await parseResponseError(\n              response,\n              `Failed to delete ${mutation.name}`\n            );\n            throw new Error(message);\n          }\n\n          const result = (await response.json()) as { txid: number };\n          return result.txid;\n        })\n      );\n\n      maybeRefreshFallbackAfterMutation(sourceKey);\n\n      if (isSourceFallbackLocked(sourceKey)) {\n        return;\n      }\n\n      return { txid: txids };\n    },\n  };\n}\n","sourceCodeStart":726,"sourceCodeEnd":762,"githubUrl":"https://github.com/BloopAI/vibe-kanban/blob/4deb7eca8f381f7cbc1f9d15515a9ab8f8009053/packages/web-core/src/shared/lib/electric/collections.ts#L726-L762","documentation":"Thrown in the ElectricSQL collection onDelete mutation handler when the DELETE request to `${mutation.url}/{key}` returns a non-ok HTTP status. It surfaces the server-provided error message via parseResponseError or the fallback 'Failed to delete <name>'. The optimistic local removal cannot be confirmed with a server txid.","triggerScenarios":"Any non-2xx response from DELETE: 401/403 auth failure, 404 if the record was already deleted, 409 on foreign-key/referential constraints, 5xx backend error.","commonSituations":"Deleting an item concurrently removed in another tab or session; deleting a parent entity the backend refuses to cascade; stale session token after idle timeout.","solutions":["Inspect the actual status code in the network tab; the thrown message may carry the server's explanation (e.g. constraint violation).","If 404, the record is already gone — refresh the collection so local state converges and the pending mutation can be dropped.","If 401/403, re-authenticate and retry the delete.","If 409 (referenced by other records), delete or reassign the dependent records first, then retry."],"exampleFix":"// before\nawait collection.delete(row);\n// after\ntry {\n  await collection.delete(row);\n} catch (e) {\n  if (String(e.message).includes('404')) {\n    await collection.refetch(); // already deleted elsewhere\n  } else {\n    throw e;\n  }\n}","handlingStrategy":"try-catch","validationCode":"const res = await fetch(`${mutation.url}/${row.id}`, { method: 'HEAD' });\nif (res.status === 404) await collection.refetch(); // already gone","typeGuard":null,"tryCatchPattern":"try {\n  await collection.delete(row);\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('Failed to delete')) {\n    console.warn('Delete failed:', e.message);\n    await collection.refetch(); // converge local state\n  } else throw e;\n}","preventionTips":["Handle concurrent deletion by refetching instead of retrying the DELETE","Check backend referential constraints before deleting parent entities","Re-authenticate on 401 before surfacing the failure to users","Log the DELETE status code; the fallback message alone hides the cause"],"tags":["http","network","electric-sql","delete"],"backgroundTag":"http-request-failed","analyzedSha":"4deb7eca8f381f7cbc1f9d15515a9ab8f8009053","analyzedAt":"2026-08-29T09:24:13.446Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}