Skip to content

[regression] app/not-found.tsx throws FUNCTION_INVOCATION_FAILED server error instead of rendering the custom error page when cacheComponents are enabled #93902

@Grod56

Description

@Grod56

Link to the code that reproduces this issue

https://codesandbox.io/p/devbox/9smrdm

To Reproduce

  1. Run the application in production i.e. next start (error only occurs in production environments)
  2. Navigate to an unmatched route that invokes notFound() in the base layout.tsx (e.g. /random.xml)
  3. The application throws the above mentioned server error instead of serving the custom 404 page

Current vs. Expected behavior

The application works as intended with the same code and exact same steps when rerun in Next.js 16.2.3 suggesting a regression between that version and Next.js 16.2.6. Like I mentioned before, the issue only comes up in production environments with cacheComponents enabled and does not reproduce in dev builds.

Request Logs:

[Error: An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error.] {
  digest: 'NEXT_HTTP_ERROR_FALLBACK;404'
}
[Error: An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error.] {
  digest: 'NEXT_HTTP_ERROR_FALLBACK;404'
}
[Error: An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error.] {
  digest: 'NEXT_HTTP_ERROR_FALLBACK;404'
}
[Error: An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error.] {
  digest: 'NEXT_HTTP_ERROR_FALLBACK;404'
}

Provide environment information

Operating System:
Platform: win32                                                                                                         
Arch: x64                                                                                                               
Version: Windows 10 Enterprise                                                                                          
Available memory (MB): 4009                                                                                            
Available CPU cores: 4                                                                                                
Binaries:                                                                                                                 
Node: 22.16.0                                                                                                           
npm: 11.12.1                                                                                                           
Yarn: N/A                                                                                                               
pnpm: 9.15.4                                                                                                          
Relevant Packages:                                                                                                        
next: 16.2.6
eslint-config-next: N/A                                                                                                 
react: 19.2.4                                                                                                           
react-dom: 19.2.4                                                                                                       
typescript: 5.9.3                                                                                                     
Next.js Config:                                                                                                           
output: N/A

Which area(s) are affected? (Select all that apply)

Error Handling

Which stage(s) are affected? (Select all that apply)

next start (local)

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Error HandlingRelated to handling errors (e.g., error.tsx, global-error.tsx).

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions