{"record":{"id":"ea0d50b6fb36a48a","repo":"nextcloud/server","slug":"tag-not-found","errorCode":null,"errorMessage":"Tag not found","messagePattern":"Tag not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"apps/systemtags/src/services/systemtags.ts","lineNumber":86,"sourceCode":"\t\t\t\tid: 0,\n\t\t\t\tsource: `${getRemoteURL()}${rootPath}`,\n\t\t\t\towner: getCurrentUser()?.uid as string,\n\t\t\t\troot: rootPath,\n\t\t\t\tpermissions: Permission.NONE,\n\t\t\t}),\n\t\t\tcontents: tagsCache.map(tagToNode),\n\t\t}\n\t}\n\n\tconst tagIdStr = path.split('/', 2)[1]\n\tif (!tagIdStr || isNaN(parseInt(tagIdStr))) {\n\t\tthrow new Error('Invalid tag ID')\n\t}\n\n\tconst tagId = parseInt(tagIdStr)\n\tconst tag = tagsCache.find((tag) => tag.id === tagId)\n\tif (!tag) {\n\t\tthrow new Error('Tag not found')\n\t}\n\n\tconst folder = tagToNode(tag)\n\tconst contentsResponse = await client.getDirectoryContents(getRootPath(), {\n\t\tdetails: true,\n\t\t// Only filter favorites if we're at the root\n\t\tdata: formatReportPayload(tagId),\n\t\theaders: {\n\t\t\t// Patched in WebdavClient.ts\n\t\t\tmethod: 'REPORT',\n\t\t},\n\t}) as ResponseDataDetailed<FileStat[]>\n\n\treturn {\n\t\tfolder,\n\t\tcontents: contentsResponse.data.map((stat) => resultToNode(stat)),\n\t}\n}","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/nextcloud/server/blob/ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3/apps/systemtags/src/services/systemtags.ts#L68-L104","documentation":"Thrown by getContents() in apps/systemtags/src/services/systemtags.ts, the virtual 'Tags' files view. It fetches all tags once (fetchTags, filtered to userVisible), parses a numeric tag id from the first path segment, and throws this error when no cached tag matches that id. It is a pure client-side cache miss, not a server response — the DAV REPORT for contents only runs after the lookup succeeds.","triggerScenarios":"Navigating the tags virtual folder to '/{tagId}' where the id is not in the freshly fetched, userVisible-filtered cache: the tag was deleted in another session, the tag exists but is not user-visible (filtered out at line 63), the path segment is a valid number but refers to a tag created after this list call, or the view was entered with a deep link to a stale id.","commonSituations":"Deep link or bookmark to /tags/{id} after the tag was removed; user-invisible tags (admin/system tags) addressed by id; race between listing the root and entering a tag; tests navigating the virtual root with hardcoded ids.","solutions":["Handle this error in the files-view router by navigating back to '/' and refetching, instead of leaving the user on a dead route","Refetch the tag list before resolving a deep link: fetchTags() and verify the id is present and userVisible","Filter out non-userVisible tags when building clickable entries, so users can never navigate into ids that cannot resolve","If the tag is expected to exist, check whether it was deleted by another session/admin before assuming a bug"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Verify the route target against a fresh tag list before navigating\nimport { fetchTags } from './services/api.ts'\n\nasync function canEnterTagFolder(tagId: number): Promise<boolean> {\n\tconst tags = await fetchTags()\n\treturn tags.some((t) => t.id === tagId && t.userVisible)\n}","typeGuard":null,"tryCatchPattern":"try {\n\tconst { folder, contents } = await getContents(`/${tagId}`)\n} catch (error) {\n\tif (error instanceof Error && error.message === 'Tag not found') {\n\t\t// navigate back to '/' and refetch instead of rendering a dead view\n\t} else throw error\n}","preventionTips":["In the tags files-view, treat 'Tag not found' as a routing signal — fall back to the root listing","Do not deep-link by tag id without revalidating against a fresh fetchTags() result","Remember non-userVisible tags are filtered client-side and will never resolve in this view"],"tags":["systemtags","files-view","cache","tag-id","typescript"],"backgroundTag":"stale-cache-lookup","analyzedSha":"ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3","analyzedAt":"2026-08-17T01:36:13.386Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}