ssssssss-team/spider-flow · error · FileNotFoundException
filePath
Error message
filePath
What it means
FileNotFoundException whose message is the offending path, thrown by FileUtils.writeBytes when new File(filePath).exists() is false. The input at fault is filePath — the file-download/export handler received a path that does not exist on disk (deleted file, wrong working directory, or a path with characters outside FILENAME_PATTERN that was never created).
Solutions
- Check the file path for typos and verify it is absolute or correct relative to the process working directory.
- Call new File(filePath).exists() before invoking writeBytes and return a friendly 'file not found' response.
- Validate uploaded/stored file names against FILENAME_PATTERN to prevent paths that were never written.
- Ensure the file-generation step ran successfully before the download is requested.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at spider-flow-core/src/main/java/org/spiderflow/core/utils/FileUtils.java:36 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of ssssssss-team/spider-flow@c799cca99c (2026-09-08).
Data as JSON: /api/errors/01c09a05c2cf9090.
Report an issue: GitHub.
Appendix: source
Thrown at spider-flow-core/src/main/java/org/spiderflow/core/utils/FileUtils.java:36
public static String FILENAME_PATTERN = "[a-zA-Z0-9_\\-\\|\\.\\u4e00-\\u9fa5]+";
/**
* 输出指定文件的byte数组
*
* @param filePath 文件路径
* @param os 输出流
* @return
*/
public static void writeBytes(String filePath, OutputStream os) throws IOException
{
FileInputStream fis = null;
try
{
File file = new File(filePath);
if (!file.exists())
{
throw new FileNotFoundException(filePath);
}
fis = new FileInputStream(file);
byte[] b = new byte[1024];
int length;
while ((length = fis.read(b)) > 0)
{
os.write(b, 0, length);
}
}
catch (IOException e)
{
throw e;
}
finally
{
if (os != null)
{
tryView on GitHub (pinned to c799cca99c)