{"record":{"id":"36de9f75b69372ec","repo":"MuntashirAkon/AppManager","slug":"file-not-found-in-virustotal","errorCode":null,"errorMessage":"File not found in VirusTotal.","messagePattern":"File not found in VirusTotal\\.","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"warning","filePath":"app/src/main/java/io/github/muntashirakon/AppManager/scanner/vt/VirusTotal.java","lineNumber":126,"sourceCode":"        if (responseReport.response != null && responseReport.response.hasReport()) {\n            // A report is found\n            response.onReportReceived(responseReport.response);\n            return;\n        }\n        // No report found: either failed or still queued\n        boolean queued = responseReport.response != null && !responseReport.response.hasReport();\n        if (!queued && !responseReport.shouldRetry()) {\n            // Retry is not available\n            throw new FileNotFoundException(\"Fetch error: \" + responseReport.error);\n        }\n        // Scan or retry\n        VtError error = Objects.requireNonNull(responseReport.error);\n        boolean waitFirst = false;\n        if (\"NotFoundError\".equals(error.code)) {\n            // Initiate scan\n            if (!response.uploadFile()) {\n                // Scanning disabled\n                throw new FileNotFoundException(\"File not found in VirusTotal.\");\n            }\n            waitFirst = true;\n            PowerManager.WakeLock wakeLock = CpuUtils.getPartialWakeLock(\"vt_upload\");\n            wakeLock.acquire();\n            try {\n                long fileSize = file.length();\n                if (fileSize > 650_000_000) {\n                    throw new IOException(\"APK is larger than 650 MB.\");\n                }\n                boolean largeFile = fileSize > 32_000_000L;\n                response.onUploadInitiated();\n                String filename = file.getName();\n                ResponseV3<String> uploadResponse;\n                try (InputStream is = file.openInputStream()) {\n                    uploadResponse = largeFile\n                            ? uploadLargeFile(filename, is)\n                            : uploadFile(filename, is);\n                }","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/AppManager/scanner/vt/VirusTotal.java#L108-L144","documentation":"When VT reports code NotFoundError for the file, fetchFileReportOrScan attempts to initiate an upload/scan. If response.uploadFile() fails (scanning disabled or upload refused), it throws FileNotFoundException(\"File not found in VirusTotal.\"). It means the file has never been seen by VT and a new scan could not be started.","triggerScenarios":"Calling fetchFileReportOrScan for a file VT has no record of (NotFoundError) while uploadFile() returns false because VT scanning is disabled in settings or the upload endpoint rejects the request.","commonSituations":"Scanning a private/never-uploaded APK with 'upload to scan' disabled in App Manager; VT account without upload permission; network restrictions blocking the upload.","solutions":["Enable file upload/scan in App Manager's scanner settings, or accept that unknown files cannot be reported.","Check network connectivity and VT API permissions, then retry.","Catch FileNotFoundException and inform the user the file is unknown to VT and could not be uploaded."],"exampleFix":"// before\nVtFileReport r = vt.fetchFileReportOrScan(file);\n// after\ntry {\n    VtFileReport r = vt.fetchFileReportOrScan(file);\n} catch (FileNotFoundException e) {\n    showNotice(\"File unknown to VirusTotal; upload disabled or failed.\");\n}","handlingStrategy":"fallback","validationCode":"// Ensure VT scanning/upload is enabled in settings before lookup:\nboolean uploadEnabled = settings.isVtUploadEnabled();","typeGuard":null,"tryCatchPattern":"try {\n    VtFileReport r = vt.fetchFileReportOrScan(file);\n} catch (FileNotFoundException e) {\n    showNotice(\"File not known to VirusTotal and upload disabled/failed.\");\n}","preventionTips":["Enable 'upload files to VirusTotal' if you want unknown files scanned.","Inform users when a file has never been submitted to VT.","Check connectivity before initiating uploads."],"tags":["network","api","virus-total","upload"],"backgroundTag":"file-not-found","analyzedSha":"0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5","analyzedAt":"2026-09-12T14:03:37.243Z","contentChangedAt":"2026-09-12T14:03:37.243Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}