{"record":{"id":"cfc866800f4b11b1","repo":"laravel/framework","slug":"dump-execution-exceeded-maximum-depth-of-30","errorCode":null,"errorMessage":"Dump execution exceeded maximum depth of 30.","messagePattern":"Dump execution exceeded maximum depth of 30\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/Illuminate/Database/MySqlSchemaState.php","lineNumber":182,"sourceCode":null,"sourceCodeStart":null,"sourceCodeEnd":null,"githubUrl":"https://github.com/laravel/framework/blob/e0f6eb3518ac29fbbca8529e97d0df7fc9f24481/src/Illuminate/Database/MySqlSchemaState.php#L182","documentation":"MySqlSchemaState::executeDumpProcess recursively retries the mysqldump/mysql shell command when specific known error phrases appear in the failure message ('column-statistics' / 'column_statistics' and 'set-gtid-purged'), each retry stripping the offending flag and incrementing $depth. The depth>30 check is a safety net that converts a runaway recursion into a clear Exception. In practice only two retry conditions exist, so reaching depth 30 indicates the retry path is matching repeatedly without resolving — a sign the underlying process error keeps re-appearing after each flag is stripped.","triggerScenarios":"Calling Schema::dump() / the migrate:fresh --seed path that triggers MySqlSchemaState (e.g. php artisan schema:dump or migration loading), where mustRun() keeps failing with one of the retry-triggering error strings on every recursion, e.g. a custom dump command template that re-adds the flags or a shell environment that rewrites the command line.","commonSituations":"Mismatched mysqldump client vs server versions repeatedly emitting 'column-statistics' errors; a configured dump binary path or process factory that injects --column-statistics back in after the grammar strips it; corrupted/looping shell quoting that breaks flag removal.","solutions":["Inspect the actual ProcessFailedException message from the inner catch (enable verbose artisan output / check logs) to see which error string is recurring.","Pin a mysqldump client version that matches the server (8.0 client against 8.0 server, or MariaDB against MariaDB) to avoid the column-statistics mismatch entirely.","If you customize the dump command via the schema state or connection config, ensure it does not re-append --column-statistics=0 or --set-gtid-purged after the retry strips them.","Set config('database.connections.mysql.dump.column_statistics', false) (Laravel's db config) or upgrade past the Laravel version whose default flags conflict with your client."],"exampleFix":"// before (config/database.php — client keeps adding column-statistics)\n'mysql' => [ /* defaults */ ],\n\n// after (explicitly disable the offending option)\n'mysql' => [\n    'driver' => 'mysql',\n    'dump' => [\n        'use_column_statistics' => false,\n    ],\n    // ...\n],","handlingStrategy":"try-catch","validationCode":"// verify the mysqldump client version and the configured dump options before dumping\n$version = DB::connection()->getPdo()->getAttribute(PDO::ATTR_CLIENT_VERSION);\n// prefer disabling the flag at config level rather than relying on the retry path","typeGuard":null,"tryCatchPattern":"use Illuminate\\Database\\Schema\\MySqlSchemaState;\nuse Symfony\\Component\\Process\\Exception\\ProcessFailedException;\n\ntry {\n    Artisan::call('schema:dump');\n} catch (\\Throwable $e) {\n    if (str_contains($e->getMessage(), 'maximum depth of 30')) {\n        // log inner ProcessFailedException details and align client/server versions\n        report($e);\n    } else {\n        throw $e;\n    }\n}","preventionTips":["Pin the mysqldump client version to match the server major version.","Set database.connections.mysql.dump options explicitly in config rather than relying on Laravel's defaults.","Inspect verbose artisan output when schema:dump fails to see the underlying ProcessFailedException."],"tags":["database","schema","mysql","mysqldump","schema-dump","recursion","process"],"backgroundTag":null,"analyzedSha":"e0f6eb3518ac29fbbca8529e97d0df7fc9f24481","analyzedAt":"2026-08-11T20:52:37.562Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}