{"record":{"id":"4ad77d342f087fbf","repo":"benweet/stackedit","slug":"dburl-is-not-accessible-make-sure-you-have-the","errorCode":null,"errorMessage":"${dbUrl} is not accessible. Make sure you have the proper permissions.","messagePattern":"(.+?) is not accessible\\. Make sure you have the proper permissions\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/services/providers/couchdbWorkspaceProvider.js","lineNumber":58,"sourceCode":"        dbUrl,\n      });\n    }\n\n    // Create the workspace if it doesn't exist\n    if (!store.getters['workspace/workspacesById'][workspaceId]) {\n      try {\n        // Make sure the database exists and retrieve its name\n        const db = await couchdbHelper.getDb(store.getters['data/couchdbTokensBySub'][workspaceId]);\n        store.dispatch('workspace/patchWorkspacesById', {\n          [workspaceId]: {\n            id: workspaceId,\n            name: db.db_name,\n            providerId: this.id,\n            dbUrl,\n          },\n        });\n      } catch (e) {\n        throw new Error(`${dbUrl} is not accessible. Make sure you have the proper permissions.`);\n      }\n    }\n\n    badgeSvc.addBadge('addCouchdbWorkspace');\n    return store.getters['workspace/workspacesById'][workspaceId];\n  },\n  async getChanges() {\n    const syncToken = store.getters['workspace/syncToken'];\n    const lastSeq = store.getters['data/localSettings'].syncLastSeq;\n    const result = await couchdbHelper.getChanges(syncToken, lastSeq);\n    const changes = result.changes.filter((change) => {\n      if (!change.deleted && change.doc) {\n        change.item = change.doc.item;\n        if (!change.item || !change.item.id || !change.item.type) {\n          return false;\n        }\n        // Build sync data\n        change.syncData = {","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/benweet/stackedit/blob/6dce2a5e36b755a0c244522b48a06c91a2df0f59/src/services/providers/couchdbWorkspaceProvider.js#L40-L76","documentation":"During CouchDB workspace initialization, the provider makes a request to the workspace database URL (dbUrl) and, if that request fails, it discards the underlying CouchDB error and throws this message from src/services/providers/couchdbWorkspaceProvider.js:58. It means the app could not reach or authenticate against the CouchDB database that backs the workspace. The real cause (network failure, 401, missing CORS headers, nonexistent DB) is hidden in the caught exception.","triggerScenarios":"The HTTP request against dbUrl inside initWorkspace throws: server unreachable, wrong dbUrl/host, invalid credentials, database deleted, or CORS blocking the browser request.","commonSituations":"Typing the wrong CouchDB URL when adding a workspace; CouchDB requiring auth for the DB; CouchDB not sending CORS headers so the browser request fails; reverse proxy or firewall blocking the endpoint.","solutions":["Verify the CouchDB URL is reachable (curl <dbUrl>) and the database exists.","Check CouchDB/CORS: enable CORS for the app origin (e.g. via add_cors in Fauxton) and allow credentials if needed.","Confirm credentials/permissions on the database (read/write for the user).","Inspect the original caught error (network tab) to distinguish DNS/connection vs 401/404."],"exampleFix":"// before\n} catch (e) {\n  throw new Error(`${dbUrl} is not accessible. Make sure you have the proper permissions.`);\n}\n// after\n} catch (e) {\n  throw new Error(`${dbUrl} is not accessible. Make sure you have the proper permissions. (${e && e.message})`);\n}","handlingStrategy":"try-catch","validationCode":"async function couchdbReachable(dbUrl) {\n  try {\n    const res = await fetch(dbUrl, { method: 'GET' });\n    return res.ok || res.status === 401;\n  } catch (e) {\n    return false; // network/CORS failure\n  }\n}","typeGuard":"function isPermissionError(err) {\n  return err && (err.status === 401 || err.status === 403 || /permission|unauthorized/i.test(err.message || ''));\n}","tryCatchPattern":"try {\n  await provider.initWorkspace(...);\n} catch (err) {\n  if (/not accessible/.test(err.message)) {\n    promptUserToCheckCouchdbUrlAndCors(err);\n  }\n}","preventionTips":["Validate the CouchDB URL and credentials before creating a workspace.","Enable CORS on CouchDB for the app origin.","Test reachability with curl or a fetch preflight before setup.","Check the browser network tab for the underlying status (401 vs network failure)."],"tags":["couchdb","network","permissions"],"backgroundTag":"remote-storage-unreachable","analyzedSha":"6dce2a5e36b755a0c244522b48a06c91a2df0f59","analyzedAt":"2026-09-01T00:49:23.866Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}