{"record":{"id":"bef29f6115f222a6","repo":"langgenius/dify","slug":"archived-document-immutable","errorCode":"archived_document_immutable","errorMessage":"The archived document is not editable.","messagePattern":"The archived document is not editable\\.","errorType":"error_code","errorClass":"ArchivedDocumentImmutableError","httpStatus":403,"severity":"error","filePath":"api/controllers/console/datasets/datasets_document.py","lineNumber":1410,"sourceCode":"    def patch(\n        self,\n        session: Session,\n        current_tenant_id: str,\n        current_user: Account,\n        dataset_id: UUID,\n        document_id: UUID,\n    ):\n        \"\"\"pause document.\"\"\"\n        dataset_id_str = str(dataset_id)\n        document_id_str = str(document_id)\n\n        document = self.get_document(session, dataset_id_str, document_id_str, current_user, current_tenant_id)\n        if not current_user.is_dataset_editor:\n            raise Forbidden()\n\n        # 403 if document is archived\n        if DocumentService.check_archived(document):\n            raise ArchivedDocumentImmutableError()\n\n        check_knowledge_rate_limit()\n        try:\n            # pause document\n            DocumentService.pause_document(document, session)\n        except services.errors.document.DocumentIndexingError:\n            raise DocumentIndexingError(\"Cannot pause completed document.\")\n\n        return \"\", 204\n\n\n@console_ns.route(\"/datasets/<uuid:dataset_id>/documents/<uuid:document_id>/processing/resume\")\nclass DocumentRecoverApi(DocumentResource):\n    @setup_required\n    @login_required\n    @account_initialization_required\n    @console_ns.response(204, \"Document resumed successfully\")\n    @with_current_user","sourceCodeStart":1392,"sourceCodeEnd":1428,"githubUrl":"https://github.com/langgenius/dify/blob/ef8544b173fd6cd7a8e71df2cab576e52bebbfbc/api/controllers/console/datasets/datasets_document.py#L1392-L1428","documentation":"HTTP 403, error_code archived_document_immutable, raised by DocumentPauseApi.patch when DocumentService.check_archived(document) returns True (datasets_document.py:1409). Archived documents are frozen and cannot be paused, resumed, or edited until un-archived.","triggerScenarios":"PATCH .../documents/{id}/processing/pause on a document whose archived flag is True (it was previously archived via the batch archive action).","commonSituations":"User selects an archived document and the pause control is still shown; bulk archive followed by an attempt to pause an item in the selection.","solutions":["Un-archive the document first via PATCH .../documents/status/un_archive/batch if processing is required.","Otherwise no action is needed - archived documents are intentionally immutable.","Hide pause/resume controls for archived documents in the UI."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"doc = console.get_document(dataset_id, document_id)\nif doc.get(\"archived\"):\n    raise RuntimeError(\"Cannot pause an archived document; un-archive it first.\")","typeGuard":"def is_archived(doc: dict) -> bool:\n    return bool(doc.get(\"archived\"))","tryCatchPattern":"try:\n    console.pause_document(dataset_id, document_id)\nexcept HTTPError as e:\n    if e.response.status_code == 403 and e.response.json().get(\"code\") == \"archived_document_immutable\":\n        notify_user(\"This document is archived. Un-archive it before pausing.\")\n    else:\n        raise","preventionTips":["Hide pause/resume controls for archived documents.","Un-archive (batch action un_archive) before attempting processing changes."],"tags":["archive","immutable","forbidden","knowledge"],"backgroundTag":null,"analyzedSha":"ef8544b173fd6cd7a8e71df2cab576e52bebbfbc","analyzedAt":"2026-08-12T05:15:17.394Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}