{"record":{"id":"8175ef15eb3e644f","repo":"nextcloud/server","slug":"failed-to-update-tag","errorCode":null,"errorMessage":"Failed to update tag","messagePattern":"Failed to update tag","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/systemtags/src/services/api.ts","lineNumber":140,"sourceCode":"\t\t<d:set>\n\t\t\t<d:prop>\n\t\t\t\t<oc:display-name>${tag.displayName}</oc:display-name>\n\t\t\t\t<oc:user-visible>${tag.userVisible}</oc:user-visible>\n\t\t\t\t<oc:user-assignable>${tag.userAssignable}</oc:user-assignable>\n\t\t\t\t<nc:color>${tag?.color || null}</nc:color>\n\t\t\t</d:prop>\n\t\t</d:set>\n\t</d:propertyupdate>`\n\n\ttry {\n\t\tawait davClient.customRequest(path, {\n\t\t\tmethod: 'PROPPATCH',\n\t\t\tdata,\n\t\t})\n\t\temit('systemtags:tag:updated', tag)\n\t} catch (error) {\n\t\tlogger.error(t('systemtags', 'Failed to update tag'), { error })\n\t\tthrow new Error(t('systemtags', 'Failed to update tag'), { cause: error })\n\t}\n}\n\n/**\n * Delete a tag.\n *\n * @param tag - The tag to delete\n */\nexport async function deleteTag(tag: TagWithId): Promise<void> {\n\tconst path = '/systemtags/' + tag.id\n\ttry {\n\t\tawait davClient.deleteFile(path)\n\t\temit('systemtags:tag:deleted', tag)\n\t} catch (error) {\n\t\tlogger.error(t('systemtags', 'Failed to delete tag'), { error })\n\t\tthrow new Error(t('systemtags', 'Failed to delete tag'), { cause: error })\n\t}\n}","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/nextcloud/server/blob/ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3/apps/systemtags/src/services/api.ts#L122-L158","documentation":"Thrown by updateTag() when the PROPPATCH request to /systemtags/{id} fails. The tag is updated by sending a property-update XML body (display-name, user-visible, user-assignable, color) and any DAV-level failure — 401, 403, 404, 5xx or a network error — is wrapped into this error with the original WebDAVClientError as `cause`.","triggerScenarios":"PROPPATCH /systemtags/{tagId} failing: 403 when the caller lacks edit rights on the tag (editing tags generally requires admin/creation-level permission), 404 when the tag was deleted after the list was loaded, 401 after session expiry, or 503 while the server is in maintenance mode.","commonSituations":"Non-admin user renaming a tag they cannot manage; tag deleted in another tab/session and the edit dialog still open; session expired during long-open admin settings; concurrent edits where another client already removed the tag.","solutions":["Inspect (error.cause as WebDAVClientError)?.response?.status: 404 → refetch the tag list (the tag is gone); 403 → the user cannot edit this tag; 401 → re-authenticate","Refetch the tag with fetchTag(tag.id) before opening the edit dialog to avoid editing stale state","Run confirmPassword() from @nextcloud/password-confirmation before admin-level tag edits","If the cause status is 5xx, check the Nextcloud server log (maintenance mode or server-side error)"],"exampleFix":"// before\nconst tag = { id: 12, displayName: 'renamed', userVisible: true, userAssignable: true }\nawait updateTag(tag as TagWithId)\n\n// after\ntry {\n\tawait updateTag(tag as TagWithId)\n} catch (e) {\n\tconst status = (e.cause as WebDAVClientError)?.response?.status\n\tif (status === 404) emit('systemtags:tag:deleted-stale', tag) // refresh list\n\telse throw e\n}","handlingStrategy":"try-catch","validationCode":"// Optional liveness pre-check\nimport { fetchTag, updateTag } from './services/api.ts'\n\nasync function safeUpdateTag(tag: TagWithId) {\n\tawait fetchTag(tag.id) // throws 'Failed to load tag' if it no longer exists\n\tawait updateTag(tag)\n}","typeGuard":null,"tryCatchPattern":"try {\n\tawait updateTag(tag)\n} catch (error) {\n\tconst status = (error.cause as WebDAVClientError | undefined)?.response?.status\n\tif (status === 404) { /* tag deleted elsewhere — refetch list */ }\n\telse if (status === 403) { /* no edit rights on this tag */ }\n\telse throw error\n}","preventionTips":["Refetch the tag before opening an edit dialog to avoid editing stale state","Run confirmPassword() for admin tag edits before the PROPPATCH","Refresh caches on 'systemtags:tag:updated' events from other clients"],"tags":["systemtags","webdav","proppatch","typescript"],"backgroundTag":"webdav-proppatch-failed","analyzedSha":"ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3","analyzedAt":"2026-08-17T01:36:13.386Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}