DevToys-app/DevToys · error · FileNotFoundException
Unable to find the indicated file.
Error message
Unable to find the indicated file.
What it means
Thrown by DevToys.CLI FileStorage.OpenReadFile after it resolves a relative path against AppCacheDirectory (Constants.AppCacheDirectory) and then finds the file missing via File.Exists. It is a deliberate FileNotFoundException with the resolved path as the fileName argument. The same IFileStorage.OpenReadFile contract is implemented identically by the Linux, MacOS, and Windows desktop platforms, so this error class is platform-wide.
Source
Thrown at src/app/dev/platforms/desktop/DevToys.CLI/Core/FileStorage/FileStorage.cs:37
{
if (!Path.IsPathRooted(relativeOrAbsoluteFilePath))
{
relativeOrAbsoluteFilePath = Path.Combine(AppCacheDirectory, relativeOrAbsoluteFilePath);
}
return File.Exists(relativeOrAbsoluteFilePath);
}
public FileStream OpenReadFile(string relativeOrAbsoluteFilePath)
{
if (!Path.IsPathRooted(relativeOrAbsoluteFilePath))
{
relativeOrAbsoluteFilePath = Path.Combine(AppCacheDirectory, relativeOrAbsoluteFilePath);
}
if (!File.Exists(relativeOrAbsoluteFilePath))
{
throw new FileNotFoundException("Unable to find the indicated file.", relativeOrAbsoluteFilePath);
}
return new FileStream(relativeOrAbsoluteFilePath, FileMode.Open, FileAccess.Read, FileShare.Read, SandboxedFileReader.BufferSize, FileOptions.Asynchronous | FileOptions.SequentialScan);
}
public FileStream OpenWriteFile(string relativeOrAbsoluteFilePath, bool replaceIfExist)
{
if (!Path.IsPathRooted(relativeOrAbsoluteFilePath))
{
relativeOrAbsoluteFilePath = Path.Combine(AppCacheDirectory, relativeOrAbsoluteFilePath);
}
if (File.Exists(relativeOrAbsoluteFilePath) && replaceIfExist)
{
File.Delete(relativeOrAbsoluteFilePath);
}
string parentDirectory = Path.GetDirectoryName(relativeOrAbsoluteFilePath)!;View on GitHub (pinned to 7e12df8448)
Solutions
- Call IFileStorage.FileExists(path) immediately before OpenReadFile and branch on the result.
- Log/inspect the resolved path (AppCacheDirectory + relative) to confirm it points where you expect.
- Ensure any producer step (OpenWriteFile) actually completed and flushed before the consumer reads.
- On case-sensitive filesystems, verify the path casing matches the file on disk.
- Wrap the call in try/catch (FileNotFoundException) and degrade gracefully (recreate, reprompt, skip).
Example fix
// before
using FileStream stream = fileStorage.OpenReadFile(relativePath);
// after
if (!fileStorage.FileExists(relativePath))
{
// recreate / reprompt / log and abort
return;
}
using FileStream stream = fileStorage.OpenReadFile(relativePath); Defensive patterns
Strategy: validation
Validate before calling
// Call before IFileStorage.OpenReadFile to avoid the throw.
string resolved = Path.IsPathRooted(path) ? path : Path.Combine(fileStorage.AppCacheDirectory, path);
if (!File.Exists(resolved))
{
// file is not there — recreate / reprompt / abort
return;
}
using FileStream stream = fileStorage.OpenReadFile(path); Try / catch
try
{
using FileStream stream = fileStorage.OpenReadFile(path);
// ... read
}
catch (FileNotFoundException ex) when (ex.FileName == path || ex.FileName == resolved)
{
// expected missing cache file — recreate or skip gracefully
} Prevention
- Always pair OpenReadFile with a preceding FileExists check; treat the pair as one contract.
- Log the resolved path (AppCacheDirectory + relative) so missing-file reports are debuggable.
- Ensure the producer (OpenWriteFile) succeeds and the stream is closed before any consumer reads.
- On case-sensitive filesystems, keep the exact on-disk casing in stored paths.
When it happens
Trigger: Calling IFileStorage.OpenReadFile(relativeOrAbsoluteFilePath) where the file was never written, was written to a different AppCacheDirectory, or was deleted between a FileExists check and the open (TOCTOU); passing a relative path that resolves under the wrong cache root; case-sensitivity mismatch on Linux.
Common situations: A tool extension reads a cache/temp file it expects another step to have created; the app cache dir was cleared or relocated; the path uses backslashes/forward slashes that resolve differently per OS; a previous OpenWriteFile failed silently so the read finds nothing.
Related errors
- Unable to find the indicated file.
- Unable to find the indicated file.
- Unable to find the indicated file.
- Unable to find the indicated file.
- WebKitGTK could not be found. Please verify that the package
AI-assisted analysis of DevToys-app/DevToys@7e12df8448 (2026-08-13).
Data as JSON: /api/errors/0e5ea163d74913ef.
Report an issue: GitHub.