Common SQL Errors

MySQL Error 1346: ER_FRM_UNKNOWN_TYPE – Diagnose, Fix, Prevent

Galaxy Team
August 6, 2025

The server finds a .frm table-definition file whose header contains an unrecognized type identifier, causing MySQL to abort table access with error 1346.

Sign up for the latest in common SQL errors from the Galaxy Team!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

What is MySQL error 1346 ER_FRM_UNKNOWN_TYPE?

MySQL Error 1346: ER_FRM_UNKNOWN_TYPE occurs when MySQL encounters a corrupted or version-mismatched .frm file. Recreate the table from a clean backup or dump to resolve the issue.

Error Highlights

Typical Error Message

File '%s' has unknown type '%s' in its header

Error Type

Storage Engine/File Error

Language

MySQL

Symbol

ER_FRM_UNKNOWN_TYPE

Error Code

1346

SQL State

HY000

Explanation

Table of Contents

What does MySQL Error 1346 ER_FRM_UNKNOWN_TYPE mean?

The error message “File '%s' has unknown type '%s' in its header” signals that MySQL cannot interpret the internal header of a .frm file. The header’s type byte tells the server which storage engine or format the table uses. When the value is missing, corrupted, or unfamiliar to the running server, MySQL raises error 1346 and aborts the operation.

When does the error appear?

The problem shows during any statement that opens the affected table: SELECT, INSERT, ALTER TABLE, CHECK TABLE, or even during server startup while loading data dictionary metadata. Replication workers will also stop if they reach the damaged table.

Why is it critical to fix quickly?

A table that triggers ER_FRM_UNKNOWN_TYPE is unreadable. Applications see immediate outages, and backups that rely on logical dumps will fail. Ignoring the corruption risks permanent data loss if the underlying disk continues to degrade.

What Causes This Error?

Most cases stem from file corruption after abrupt power loss, disk failures, or incomplete file copies between servers running different MySQL versions. The header also becomes unrecognizable if the table was created with a third-party storage engine that is no longer installed.

How to Fix MySQL Error 1346 ER_FRM_UNKNOWN_TYPE

First isolate the table by stopping writes or putting the schema in maintenance mode. Extract good data from backups or a replica that does not show the error. Recreate the table definition, then reload data. If no backup exists, attempt to salvage rows with a low-level tool such as mysqlfrm plus SELECT...INTO OUTFILE from the .ibd if InnoDB-file-per-table is enabled.

Common Scenarios and Solutions

On-premise servers that crashed without innodb_flush_log_at_trx_commit=1 often corrupt MyISAM .frm headers; running REPAIR TABLE sometimes rewrites a valid header. Migration from MariaDB to MySQL 8 can break tables that used the Aria engine; reinstalling the corresponding plugin lets MySQL parse the header again.

Best Practices to Avoid This Error

Keep identical MySQL versions across all nodes, enable crash-safe settings, and verify backups daily. Use mysqldump or MySQL Shell dump to move tables instead of copying raw .frm files. Monitor the error log with Galaxy’s alerting to catch file issues early.

Related Errors and Solutions

Error 1030 (HY000) ER_GET_ERRNO appears when the .frm file is intact but the underlying data file is missing. Error 126 (HY000) INDEX_CHKSUM_ERROR fires when index pages are corrupt. The troubleshooting flow is similar—verify backups, diagnose storage health, then rebuild the table.

Common Causes

Corrupted disk sectors

Bad blocks on the storage device alter bytes in the .frm header, making MySQL read an invalid type value.

Version mismatch

Copying .frm files from an older or MariaDB server introduces type codes that a newer MySQL release does not recognize.

Missing storage engine plugin

If a table was created with a pluggable engine such as TokuDB, removing that plugin leaves the server unable to interpret the header.

Partial file copy or restore

Interrupted SCP or rsync operations leave the .frm truncated, wiping out the type byte in the header.

Power outage during DDL

A crash while writing metadata can leave the header in an inconsistent, half-written state.

Related Errors

Error 1030 ER_GET_ERRNO

Signals OS-level failure reading table data files; often follows if the .ibd file is missing.

Error 126 Incorrect key file for table

Occurs when MyISAM index files are corrupt; REPAIR TABLE may recover indexes.

Error 1146 Table doesn't exist

Raised when the .frm file is missing entirely; recreate table or restore from backup.

Error 1356 View select tables does not exist

Happens when a view references a table that was dropped or damaged.

FAQs

Can I fix ER_FRM_UNKNOWN_TYPE without dropping the table?

If you still have a good backup, you can rename the corrupted .frm, copy a healthy .frm from backup, and run FLUSH TABLES; however, this risks version mismatches.

Does InnoDB suffer from this error?

Yes. Although row data sits in .ibd files, the .frm header still describes the table and must be intact.

Will upgrading MySQL remove the error?

Upgrading rarely helps; the header is already unreadable. Upgrade only after restoring or rebuilding the table.

How does Galaxy help prevent the issue?

Galaxy centralizes vetted DDL in shared collections, discouraging raw file copies and catching corruptions through built-in linting and query history.

Start Querying with the Modern SQL Editor Today!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

Check out some other errors

Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie Logo
Bauhealth Logo
Truvideo Logo