Bug Report
Description
Forge fails to open files whose paths contain square brackets ([ and ]). This is a common pattern in Next.js projects that use dynamic routes (e.g. [locale], [id], [slug]).
Steps to Reproduce
- Have a Next.js project with a dynamic route layout file, e.g.:
src/app/[locale]/layout.tsx
- Reference the file in conversation or let Forge attempt to read it.
Expected Behavior
The file should be opened and read successfully, as the square brackets are literal characters in the filesystem path.
Actual Behavior
Forge produces the following error:
ERROR: Failed to open file .../src/app/[locale
Caused by:
No such file or directory (os error 2)
The path is truncated at the [ character — everything from [locale] onward (including ]/layout.tsx) is stripped or lost, resulting in an invalid path.
Impact
This affects any project using:
- Next.js App Router dynamic routes (
[param], [...catchAll], [[...optional]])
- Any framework or convention that uses square brackets in directory/file names
Since Next.js App Router is one of the most popular frontend frameworks, this is a significant usability issue.
Environment
- macOS
- Forge CLI (latest as of 2025-04-10)
Bug Report
Description
Forge fails to open files whose paths contain square brackets (
[and]). This is a common pattern in Next.js projects that use dynamic routes (e.g.[locale],[id],[slug]).Steps to Reproduce
Expected Behavior
The file should be opened and read successfully, as the square brackets are literal characters in the filesystem path.
Actual Behavior
Forge produces the following error:
The path is truncated at the
[character — everything from[locale]onward (including]/layout.tsx) is stripped or lost, resulting in an invalid path.Impact
This affects any project using:
[param],[...catchAll],[[...optional]])Since Next.js App Router is one of the most popular frontend frameworks, this is a significant usability issue.
Environment