{"record":{"id":"c3502b882068f7da","repo":"immich-app/immich","slug":"the-route-request-path-was-requested-as-reque","errorCode":null,"errorMessage":"The route ${request.path} was requested as ${request.header('accept')}, but only returns text/html","messagePattern":"The route (.+?) was requested as (.+?), but only returns text/html","errorType":"exception","errorClass":"NotAcceptableException","httpStatus":406,"severity":"error","filePath":"server/src/services/api.service.ts","lineNumber":61,"sourceCode":"    try {\n      index = readFileSync(resourcePaths.web.indexHtml).toString();\n    } catch {\n      this.logger.warn(`Unable to open ${resourcePaths.web.indexHtml}, skipping SSR.`);\n    }\n\n    return async (request: Request, res: Response, next: NextFunction) => {\n      const method = request.method.toLowerCase();\n      if (\n        request.url.startsWith('/api') ||\n        (method !== 'get' && method !== 'head') ||\n        excludePaths.some((item) => request.url.startsWith(item))\n      ) {\n        return next();\n      }\n\n      const responseType = request.accepts('text/html');\n      if (!responseType) {\n        throw new NotAcceptableException(\n          `The route ${request.path} was requested as ${request.header('accept')}, but only returns text/html`,\n        );\n      }\n\n      let status = 200;\n      let html = index;\n\n      const defaultDomain = request.host ? `${request.protocol}://${request.host}` : undefined;\n\n      let meta: OpenGraphTags | null = null;\n\n      const shareKey = request.url.match(/^\\/share\\/(.+)$/);\n      if (shareKey) {\n        try {\n          const key = shareKey[1];\n          const auth = await this.authService.validateSharedLinkKey(key);\n          meta = await this.sharedLinkService.getMetadataTags(auth, defaultDomain);\n        } catch {","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/immich-app/immich/blob/e55ac299a4ec7cb372e35dbf2c6c05ee9ce77f6c/server/src/services/api.service.ts#L43-L79","documentation":"Raised by the SSR middleware in ApiService when a non-/api GET/HEAD request negotiates a response type other than text/html (request.accepts('text/html') is falsy). The server-rendered web client can only serve HTML, so clients asking for JSON or another content type on a web route get this error instead of the SPA index. The inputs at fault are the request's path and Accept header.","triggerScenarios":"Thrown at server/src/services/api.service.ts:61 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Send Accept: text/html (or */*) when fetching web routes","Use the /api-prefixed REST endpoints for machine-readable responses"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e55ac299a4ec7cb372e35dbf2c6c05ee9ce77f6c","analyzedAt":"2026-09-15T07:20:19.675Z","contentChangedAt":"2026-09-15T07:20:19.675Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}