{"record":{"id":"fe4f6f65940a2728","repo":"lingochamp/FileDownloader","slug":"getfilename","errorCode":null,"errorMessage":"getFileName","messagePattern":"getFileName","errorType":"exception","errorClass":"NoFieldException","httpStatus":null,"severity":"error","filePath":"library/src/main/java/com/liulishuo/filedownloader/message/MessageSnapshot.java","lineNumber":88,"sourceCode":"\n    @Override\n    public int getSmallSofarBytes() {\n        throw new NoFieldException(\"getSmallSofarBytes\", this);\n    }\n\n    @Override\n    public int getSmallTotalBytes() {\n        throw new NoFieldException(\"getSmallTotalBytes\", this);\n    }\n\n    @Override\n    public boolean isReusedDownloadedFile() {\n        throw new NoFieldException(\"isReusedDownloadedFile\", this);\n    }\n\n    @Override\n    public String getFileName() {\n        throw new NoFieldException(\"getFileName\", this);\n    }\n\n    @Override\n    public boolean isLargeFile() {\n        return isLargeFile;\n    }\n\n\n    public interface IWarnMessageSnapshot {\n        MessageSnapshot turnToPending();\n    }\n\n\n    @Override\n    public int describeContents() {\n        return 0;\n    }\n","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/lingochamp/FileDownloader/blob/6237a8cac174bcc916e4342b14ab1ab72a5768d4/library/src/main/java/com/liulishuo/filedownloader/message/MessageSnapshot.java#L70-L106","documentation":"This is not a system error but a sentinel guard: the MessageSnapshot subclass backing this object simply does not carry a filename field, so any call to getFileName() throws NoFieldException. It fires when code asks a sparse snapshot (e.g. a pending/connected/progress snapshot created without file metadata) for a field it never stored; the fault lies with the caller accessing an absent field, not with the snapshot data itself.","triggerScenarios":"Thrown at library/src/main/java/com/liulishuo/filedownloader/message/MessageSnapshot.java:88 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the snapshot type/status before calling getFileName(); only completed or file-aware snapshots carry the name","Obtain the filename from the FileDownloadTask/DownloadStatusTask or the download database rather than from a snapshot that may lack it","Catch NoFieldException when iterating heterogeneous snapshots and skip or default the field","When creating snapshots that consumers will query for filenames, use a snapshot variant that includes the filename field"],"exampleFix":null,"handlingStrategy":"type-guard","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"}