[BUG] Claude generates Filament v3 code patterns instead of v4, causing fatal errors

Resolved 💬 4 comments Opened Dec 10, 2025 by flashmediasolutions Closed Feb 10, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

FROM CLAUDE:

Description

When working on a Laravel project using Filament v4, Claude consistently generates code using
Filament v3 patterns, resulting in fatal PHP errors. This happens even when:

  1. The codebase clearly uses Filament v4
  2. CLAUDE.md explicitly documents the v3→v4 differences
  3. Working v4 examples exist in the same codebase
  4. The user has corrected the same mistake multiple times in the conversation

Impact

  • Site-breaking errors: Fatal PHP errors crash the application
  • Repeated corrections: User must fix the same issue across multiple files
  • Lost productivity: Each new resource/component risks the same mistake
  • Trust erosion: User cannot rely on generated Filament code being correct

Expected Behavior

Claude should:

  1. Recognize Filament v4 from composer.json, existing code patterns, or explicit documentation
  2. Generate v4-compatible code by default for projects using v4
  3. When corrected once, apply the fix pattern consistently to subsequent code generation

Environment

  • Filament v4
  • Laravel 12.x
  • PHP 8.3

Suggested Improvements

  1. Update training data: Include Filament v4 patterns and migration guides
  2. Context awareness: Detect Filament version from composer.json or composer.lock
  3. Pattern matching: When working code exists in the codebase, match its import/usage patterns
  4. Session learning: When corrected, apply the correction to all subsequent related code

What Should Happen?

When generating Filament code, Claude should detect
the Filament version from the project (via
composer.json, existing code patterns, or explicit
documentation like CLAUDE.md) and generate
version-appropriate code. For Filament v4 projects,
Claude should use the correct v4 import paths and
method signatures instead of defaulting to v3
patterns.

Additionally, when corrected within a conversation,
Claude should apply that correction consistently
to all subsequent code generation in the same
session rather than repeating the same mistake.

Error Messages/Logs

Error
app/Filament/Admin/Resources/RegisteredDomainResource.php:221
Class "Filament\Schemas\Components\TextEntry" not found

Steps to Reproduce

Here's the steps to reproduce:

---

  1. Create a Laravel project with Filament v4

installed

  1. Add a CLAUDE.md file documenting Filament v4

patterns (optional but shows even explicit
documentation doesn't prevent the issue):
## Filament v4 (CRITICAL)
This project uses Filament v4. Use these patterns:

  • Infolist entries:

Filament\Infolists\Components\TextEntry

  • Schema method: infolist(Schema $schema): Schema
  • Outer schema uses ->schema([...])
  • Section uses ->components([...])
  1. Ask Claude to create a Filament resource with an

infolist:
Create a Filament resource for a User model with a
view page that shows an infolist with name, email,
and status fields

  1. Claude generates code with v3 patterns:

use Filament\Schemas\Components\TextEntry; //
WRONG - class doesn't exist in v4

public static function infolist(Schema $schema):
Schema
{
return $schema
->components([ // WRONG - should be
->schema()
Section::make('User')
->schema([ // WRONG - should be
->components()
TextEntry::make('name'), //
WRONG - needs InfolistComponents\ prefix
]),
]);
}

  1. Application crashes with:

Class "Filament\Schemas\Components\TextEntry" not
found

  1. Correct Claude and ask it to fix the issue
  2. Ask Claude to create another resource with an

infolist

  1. Claude generates the same incorrect v3 patterns

again, despite the previous correction

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.0.62 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Warp

Additional Information

_No response_

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗