{"record":{"id":"b08cc87d67cab967","repo":"lingochamp/FileDownloader","slug":"please-use-catchwarn-instead-d","errorCode":null,"errorMessage":"please use #catchWarn instead %d","messagePattern":"please use #catchWarn instead (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"library/src/main/java/com/liulishuo/filedownloader/message/MessageSnapshotTaker.java","lineNumber":107,"sourceCode":"    }\n\n    public static MessageSnapshot takeBlockCompleted(MessageSnapshot snapshot) {\n        if (snapshot.getStatus() != FileDownloadStatus.completed) {\n            throw new IllegalStateException(\n                    FileDownloadUtils.formatString(\"take block completed snapshot, must has \"\n                                    + \"already be completed. %d %d\",\n                            snapshot.getId(), snapshot.getStatus()));\n        }\n\n        return new BlockCompleteMessage.BlockCompleteMessageImpl(snapshot);\n    }\n\n    public static MessageSnapshot take(byte status, FileDownloadModel model,\n                                       DownloadStatusCallback.ProcessParams processParams) {\n        final MessageSnapshot snapShot;\n        final int id = model.getId();\n        if (status == FileDownloadStatus.warn) {\n            throw new IllegalStateException(FileDownloadUtils.\n                    formatString(\"please use #catchWarn instead %d\", id));\n        }\n\n        switch (status) {\n            case FileDownloadStatus.pending:\n                if (model.isLargeFile()) {\n                    snapShot = new LargeMessageSnapshot.PendingMessageSnapshot(id,\n                            model.getSoFar(), model.getTotal());\n                } else {\n                    snapShot = new SmallMessageSnapshot.PendingMessageSnapshot(id,\n                            (int) model.getSoFar(), (int) model.getTotal());\n                }\n                break;\n            case FileDownloadStatus.started:\n                snapShot = new MessageSnapshot.StartedMessageSnapshot(id);\n                break;\n            case FileDownloadStatus.connected:\n                final String filename = model.isPathAsDirectory() ? model.getFilename() : null;","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/lingochamp/FileDownloader/blob/6237a8cac174bcc916e4342b14ab1ab72a5768d4/library/src/main/java/com/liulishuo/filedownloader/message/MessageSnapshotTaker.java#L89-L125","documentation":"A deprecation/contract guard in MessageSnapshotTaker: the called method no longer handles warning notifications (it only carries the id of the task). Clients must call #catchWarn instead; the %d is the download id being processed when the legacy path was hit.","triggerScenarios":"Thrown at library/src/main/java/com/liulishuo/filedownloader/message/MessageSnapshotTaker.java:107 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Replace calls to the old snapshot-taking method with MessageSnapshotTaker.catchWarn(task) to capture warning snapshots","Upgrade FileDownloader to a version where the download-flow dispatch uses catchWarn internally","If you implement a custom download flow, route warn callbacks through catchWarn rather than the deprecated method"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6237a8cac174bcc916e4342b14ab1ab72a5768d4","analyzedAt":"2026-09-08T23:50:48.168Z","contentChangedAt":"2026-09-08T23:50:48.168Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}