{"record":{"id":"36bdc295579ad4de","repo":"SonarSource/sonarqube","slug":"can-not-read-file","errorCode":null,"errorMessage":"Can not read file ","messagePattern":"Can not read file ","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/MutableDumpReaderImpl.java","lineNumber":76,"sourceCode":"  public File zipFile() {\n    checkState(zipFile != null, \"Project dump file has not been set\");\n    return zipFile;\n  }\n\n  @Override\n  public File tempRootDir() {\n    checkState(tempRootDir != null, \"Dump file has not been extracted\");\n    return tempRootDir;\n  }\n\n  @Override\n  public ProjectDump.Metadata metadata() {\n    File file = new File(tempRootDir(), METADATA.filename());\n    checkState(file.exists(), \"Missing metadata file: %s\", file);\n    try (FileInputStream input = FILES2.openInputStream(file)) {\n      return PROTOBUF2.parseFrom(METADATA.parser(), input);\n    } catch (IOException e) {\n      throw new IllegalStateException(\"Can not read file \" + file, e);\n    }\n  }\n\n  @Override\n  public <M extends Message> MessageStream<M> stream(DumpElement<M> elt) {\n    File file = new File(tempRootDir(), elt.filename());\n    checkState(file.exists(), \"Missing file: %s\", file);\n\n    InputStream input = FILES2.openInputStream(file);\n    return new MessageStreamImpl<>(input, elt.parser());\n  }\n}\n","sourceCodeStart":58,"sourceCodeEnd":89,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectexport/steps/MutableDumpReaderImpl.java#L58-L89","documentation":"MutableDumpReaderImpl.metadata() parses the dump's metadata protobuf file from the task's temp directory. If the file exists but cannot be read/parsed (IOException from FileInputStream or protobuf parseFrom), it wraps the IOException in an IllegalStateException naming the file. This indicates the dump on disk is unreadable or corrupt.","triggerScenarios":"METADATA file exists at tempRootDir() but FileInputStream open or PROTOBUF2.parseFrom throws IOException — truncated/corrupt dump file, file deleted between the exists() check and the read, or permission/I/O error while reading.","commonSituations":"A project dump truncated by a full disk or killed CE process; a dump zip extracted partially; the dump was moved/rotated while the task was running; NFS or network storage briefly unavailable.","solutions":["Re-run the CE task so a fresh, complete dump is produced","Verify the dump directory contents are complete and not truncated (compare file sizes/checksums)","Check disk space and filesystem health on the CE worker temp directory","If dumps are on network storage, verify it is mounted and stable during task execution"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"File meta = new File(tempRootDir(), \"metadata.pb\");\nif (!meta.isFile() || meta.length() == 0) {\n  throw new IllegalStateException(\"Dump metadata missing or empty: \" + meta);\n}","typeGuard":null,"tryCatchPattern":"try {\n  ProjectDump.Metadata md = reader.metadata();\n} catch (IllegalStateException e) {\n  // dump corrupt/incomplete — request a fresh export instead of retrying parse\n  LOGGER.error(\"Dump unreadable at {}: {}\", tempRootDir(), e.getCause(), e);\n}","preventionTips":["Never move or prune the dump directory while a CE task is running","Monitor disk space so dumps are not truncated","Keep dumps on local or stable storage, not flaky network mounts","Re-export rather than retry parsing a known-truncated dump"],"tags":["protobuf","dump","file-read","compute-engine"],"backgroundTag":"protobuf-unmarshal-failed","analyzedSha":"184c821202192afc1c599fc912d0889b69fffa53","analyzedAt":"2026-09-09T12:23:51.573Z","contentChangedAt":"2026-09-09T12:23:51.573Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}