{"record":{"id":"610406952043f373","repo":"laurent22/joplin","slug":"404","errorCode":"404","errorMessage":"The specified file doesn't exist.","messagePattern":"The specified file doesn't exist\\.","errorType":"http","errorClass":"JoplinError","httpStatus":404,"severity":"info","filePath":"packages/lib/file-api-driver-webdav.js","lineNumber":173,"sourceCode":"\t\t});\n\n\t\treturn {\n\t\t\titems: stats,\n\t\t\thasMore: false,\n\t\t\tcontext: null,\n\t\t};\n\t}\n\n\tasync get(path, options) {\n\t\tif (!options) options = {};\n\t\tif (!options.responseFormat) options.responseFormat = 'text';\n\t\ttry {\n\t\t\tconst response = await this.api().exec('GET', path, null, null, options);\n\n\t\t\t// This is awful but instead of a 404 Not Found, Microsoft IIS returns an HTTP code 200\n\t\t\t// with a response body \"The specified file doesn't exist.\" for non-existing files,\n\t\t\t// so we need to check for this.\n\t\t\tif (response === 'The specified file doesn\\'t exist.') throw new JoplinError(response, 404);\n\t\t\treturn response;\n\t\t} catch (error) {\n\t\t\tif (error.code !== 404) throw error;\n\t\t\treturn null;\n\t\t}\n\t}\n\n\tasync mkdir(path) {\n\t\ttry {\n\t\t\t// RFC wants this, and so does NGINX. Not having the trailing slash means that some\n\t\t\t// WebDAV implementations will redirect to a URL with \"/\". However, when doing so\n\t\t\t// in React Native, the auth headers, etc. are lost so we need to avoid this.\n\t\t\t// https://github.com/facebook/react-native/issues/929\n\t\t\tif (!path.endsWith('/')) path = `${path}/`;\n\t\t\tawait this.api().exec('MKCOL', path);\n\t\t} catch (error) {\n\t\t\tif (error.code === 405) return; // 405 means that the collection already exists (Method Not Allowed)\n","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/laurent22/joplin/blob/2654b33620775080d1d59c552259d41e33dad3d2/packages/lib/file-api-driver-webdav.js#L155-L191","documentation":"Synthesized by the WebDAV driver's get(): Microsoft IIS (and some other servers) respond to GET of a missing file with HTTP 200 and a body literally reading \"The specified file doesn't exist.\" instead of the correct 404. The driver detects that exact body and throws a JoplinError with code 404 so the caller's not-found handling triggers normally.","triggerScenarios":"Calling get() for a path that doesn't exist on an IIS-backed WebDAV server. The driver converts the non-standard 200 body into a 404 JoplinError, which the surrounding try/catch then maps to a null return.","commonSituations":"Syncing against an IIS WebDAV target where a note/resource was deleted remotely; first-time sync probing for files that haven't been created yet; IIS configured to return friendly error pages instead of proper status codes.","solutions":["No action needed if you're a normal caller — get() returns null for missing files; this error is internal and already handled.","If you see it propagate, configure IIS to return standard HTTP 404 instead of a 200 with an error body (disable custom error pages / HTTP errors for the WebDAV site).","Upgrade the WebDAV server module; newer IIS WebDAV implementations return correct status codes.","Switch to a more standards-compliant WebDAV server."],"exampleFix":"// This is a workaround for non-standards-compliant servers; callers already get null.\n// To remove the need for the workaround server-side, configure IIS:\n//   <httpErrors errorMode=\"Detailed\" existingResponse=\"PassThrough\" />\n// so missing files return 404 instead of 200 + body.","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"function isIisMissingFileBody(body: any): boolean {\n  return typeof body === 'string' && body === \"The specified file doesn't exist.\";\n}","tryCatchPattern":"// Already handled internally - get() returns null for missing files.\nconst data = await driver.get(path);\nif (data === null) { /* file does not exist - normal not-found path */ }","preventionTips":["Treat a null return from get() as 'not found' rather than inspecting errors.","If you administer the IIS server, disable custom error pages so it returns real 404s.","Prefer standards-compliant WebDAV servers to avoid this workaround path."],"tags":["webdav","sync","iis","http-404","compatibility"],"backgroundTag":null,"analyzedSha":"2654b33620775080d1d59c552259d41e33dad3d2","analyzedAt":"2026-08-12T14:26:46.263Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}