{"record":{"id":"f7c27e58c0558b78","repo":"laravel/framework","slug":"there-is-no-column-with-name-column-on-table","errorCode":null,"errorMessage":"There is no column with name '$column' on table '$table'.","messagePattern":"There is no column with name '\\$column' on table '\\$table'\\.","errorType":"exception","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"src/Illuminate/Database/Schema/Builder.php","lineNumber":373,"sourceCode":"     *\n     * @param  string  $table\n     * @param  string  $column\n     * @param  bool  $fullDefinition\n     * @return string\n     *\n     * @throws \\InvalidArgumentException\n     */\n    public function getColumnType($table, $column, $fullDefinition = false)\n    {\n        $columns = $this->getColumns($table);\n\n        foreach ($columns as $value) {\n            if (strtolower($value['name']) === strtolower($column)) {\n                return $fullDefinition ? $value['type'] : $value['type_name'];\n            }\n        }\n\n        throw new InvalidArgumentException(\"There is no column with name '$column' on table '$table'.\");\n    }\n\n    /**\n     * Get the column listing for a given table.\n     *\n     * @param  string  $table\n     * @return list<string>\n     */\n    public function getColumnListing($table)\n    {\n        return array_column($this->getColumns($table), 'name');\n    }\n\n    /**\n     * Get the columns for a given table.\n     *\n     * @param  string  $table\n     * @return list<array{name: string, type: string, type_name: string, collation: string|null, nullable: bool, default: mixed, auto_increment: bool, comment: string|null, generation: array{type: string, expression: string|null}|null}>","sourceCodeStart":355,"sourceCodeEnd":391,"githubUrl":"https://github.com/laravel/framework/blob/e0f6eb3518ac29fbbca8529e97d0df7fc9f24481/src/Illuminate/Database/Schema/Builder.php#L355-L391","documentation":"Thrown by Schema\\Builder::getColumnType() after it iterates every column returned by getColumns() and finds no case-insensitive match for the requested name. It is an InvalidArgumentException, meaning the call itself is invalid for the current table state - the column genuinely is not visible to the driver's introspection query. The comparison uses strtolower on both sides, so case is never the culprit; the column is absent, misnamed, or not yet migrated.","triggerScenarios":"Calling Schema::getColumnType($table, $column) (or any internal caller such as renameColumn/change detection) with a column name that does not exist in information_schema for that table. Also fires when $table is schema-qualified or carries a prefix that double-resolves, so the introspection query targets the wrong physical table.","commonSituations":"Migration that adds the column has not been run on the current connection; typo in the column name; quoting the wrong table or supplying a prefix the connection already applies; pointing at a read-replica whose DDL has not propagated; the column is a view column or alias, not a real information_schema column.","solutions":["Run the outstanding migration on this connection (php artisan migrate) and confirm the column exists with Schema::getColumnListing($table).","Verify the exact column name against the database (SHOW COLUMNS, \\d table, sp_columns) - getColumnType matches case-insensitively, so a mismatch means the column truly is missing.","Pass the un-prefixed table name; getColumns() prepends connection->getTablePrefix() itself.","If using a schema-qualified reference like 'public.users', confirm parseSchemaAndTable resolves it to the schema the driver introspects.","Guard with Schema::hasColumn($table, $column) before invoking getColumnType."],"exampleFix":"// before\n$type = Schema::getColumnType('users', 'email_address');\n\n// after\nif (Schema::hasColumn('users', 'email_address')) {\n    $type = Schema::getColumnType('users', 'email_address');\n} else {\n    $type = Schema::getColumnType('users', 'email'); // correct name\n}","handlingStrategy":"validation","validationCode":"use Illuminate\\Support\\Facades\\Schema;\n\nif (Schema::hasColumn($table, $column)) {\n    $type = Schema::getColumnType($table, $column);\n} else {\n    throw new \\DomainException(\"Column {$column} not found on {$table}; available: \" . implode(',', Schema::getColumnListing($table)));\n}","typeGuard":"function columnExists(string $table, string $column): bool\n{\n    return in_array(\n        strtolower($column),\n        array_map('strtolower', Schema::getColumnListing($table)),\n        true\n    );\n}","tryCatchPattern":"try {\n    $type = Schema::getColumnType($table, $column);\n} catch (\\InvalidArgumentException $e) {\n    Log::warning('Column type lookup failed', ['table' => $table, 'column' => $column]);\n    throw $e;\n}","preventionTips":["Always call Schema::hasColumn() before Schema::getColumnType() when the column name is dynamic.","Run migrations before any code that introspects schema, including in test setup.","Never include the table prefix in the $table argument - getColumns() applies it for you."],"tags":["schema","database-introspection","migration","invalid-argument"],"backgroundTag":null,"analyzedSha":"e0f6eb3518ac29fbbca8529e97d0df7fc9f24481","analyzedAt":"2026-08-11T20:52:37.562Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}