{"record":{"id":"d8cb27f396364fee","repo":"ToolJet/ToolJet","slug":"failed-to-update-document-response-statustext","errorCode":null,"errorMessage":"Failed to update document: ${response.statusText}","messagePattern":"Failed to update document: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"marketplace/plugins/couchbase/lib/query_operations.ts","lineNumber":75,"sourceCode":"    throw new Error('Missing required parameters');\n  }\n\n  let parsedDocument;\n  if (document) {\n    parsedDocument = typeof document === 'string' ? JSON.parse(document) : document;\n  }\n\n  const dapi_url = `${data_api_url}/v1/buckets/${bucket}/scopes/${scope}/collections/${collection}/documents/${document_id}`;\n  const response = await fetch(dapi_url, {\n    method: 'PUT',\n    headers: {\n      'Content-Type': 'application/json',\n      Authorization: `Basic ${Buffer.from(`${username}:${password}`).toString('base64')}`,\n    },\n    body: JSON.stringify(parsedDocument),\n  });\n  if (!response.ok) {\n    throw new Error(`Failed to update document: ${response.statusText}`);\n  }\n  await response.json().catch((error) => {\n    if (!response.ok) {\n      throw error;\n    }\n  });\n  return 'Updated successfully';\n}\n\nexport async function deleteDocument(options: QueryOptions, sourceOptions: SourceOptions) {\n  const { bucket, scope, collection, document_id } = options;\n  const { username, password, data_api_url } = sourceOptions;\n  if (!bucket || !scope || !collection || !document_id) {\n    throw new Error('Missing required parameters');\n  }\n  const dapi_url = `${data_api_url}/v1/buckets/${bucket}/scopes/${scope}/collections/${collection}/documents/${document_id}`;\n  const response = await fetch(dapi_url, {\n    method: 'DELETE',","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/ToolJet/ToolJet/blob/20602a8e101f2e59686c9afde0d1402aac2c8871/marketplace/plugins/couchbase/lib/query_operations.ts#L57-L93","documentation":"Error \"Failed to update document: ${response.statusText}\" thrown in ToolJet/ToolJet.","triggerScenarios":"Document update request fails: document missing, CAS conflict, or invalid payload.","commonSituations":"Defend by verifying the document exists and the body is valid before updating; propagate the server statusText.","solutions":["Ensure the document_id exists before updating.","Validate the document JSON body.","Verify write permissions on the collection."],"exampleFix":"Fetch the document first to confirm it exists, then retry the update with a valid JSON body.","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"20602a8e101f2e59686c9afde0d1402aac2c8871","analyzedAt":"2026-08-13T05:58:54.221Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}