Symfony Make:Migration : The metadata storage is not up to date, please run the sync-metadata-storage command to fix this issue

Symfony Make:Migration : The metadata storage is not up to date, please run the sync-metadata-storage command to fix this issue

  1. Blog
  2. 15 November 2026
  3. 4 min read

Stefan Bogdanescu

Founder & Senior Architect

Symfony Make:Migration : The metadata storage is not up to date, please run the sync-metadata-storage command to fix this issue

The error message "The metadata storage is not up to date, please run the sync-metadata-storage command" usually appears when Doctrine tries to generate a migration but detects a mismatch between your application's current state and what it believes exists. This often happens in environments where the cache has been invalidated or after upgrading Symfony components, leaving Doctrine unable to reconcile the internal metadata with the database schema.

When you run php bin/console make:migration, Doctrine scans your entities and compares them against the existing migrations in the migrations directory. If it cannot locate a valid metadata store that matches the current project state, it halts execution to prevent generating incorrect SQL based on stale data. The same issue manifests with doctrine:migration status, which relies on this metadata to report whether your database is in sync with the application code.

Running doctrine:migration:sync-metadata-storage is the standard remedy, but if you are still seeing errors after executing it, the root cause usually lies in how Doctrine loads its configuration or where the metadata is actually being cached. In Symfony 4.4 with PHP 7.2, this often points to a misconfigured cache directory or an outdated doctrine_migrations table.

Doctrine stores its internal representation of your entities and database tables in a specific location. By default, this is the Doctrine Metadata Cache. If this cache is stale or missing, Doctrine assumes your schema is out of sync with the codebase. The sync-metadata-storage command attempts to clear this cache and force Doctrine to rebuild it based on your current entity definitions and the actual database state.

However, simply running the command without verifying the underlying configuration can lead to a loop where the error persists. One common pitfall is ensuring that the cache directory specified in your .env file or config/packages/doctrine.yaml is writable and correctly pointed to. If the application runs under a user with restricted file permissions, Doctrine might fail to write the updated metadata back to disk.

Another frequent cause involves the doctrine_migrations table itself. Doctrine uses this table to track which migrations have been applied. If this table is missing or corrupted, Doctrine cannot determine the current state of your schema, triggering the metadata sync error. To resolve this, you may need to ensure the database migration table exists and is accessible:

CREATE TABLE IF NOT EXISTS doctrine_migrations (
  version VARCHAR(100) NOT NULL PRIMARY KEY
);

After recreating or verifying the table, run the sync command again:

php bin/console doctrine:migration:sync-metadata-storage

If you still encounter issues, check your config/packages/doctrine.yaml to ensure that the metadata cache is properly configured. In older Symfony versions, explicit configuration of the cache driver was sometimes required:

doctrine:
    orm:
        metadata_cache_driver:
            type: service
            id: cache.doctrine.orm.metadata
        query_cache_driver:
            type: service
            id: cache.doctrine.orm.query
        result_cache_driver:
            type: service
            id: cache.doctrine.orm.result

Make sure these cache services are defined in your kernel or a dedicated cache configuration file, and that they point to a valid directory (e.g., var/cache/doctrine). Without a functional cache backend, Doctrine cannot store the necessary metadata between requests.

If you recently upgraded Symfony or Doctrine without running migrations, the version tracking in the database might be out of sync with the installed package versions. In such cases, it is advisable to clear the application cache entirely:

rm -rf var/cache/*
php bin/console cache:clear

Then retry doctrine:migration:sync-metadata-storage. This ensures that no stale bytecode or cached configuration interferes with the metadata resolution process.

For teams using multiple environments, ensure that the .env file is committed to version control for local development but contains environment-specific overrides for production. Discrepancies in cache paths between local and remote servers often lead to this exact error appearing only on one end.

If all else fails and you suspect the migration table or metadata store is irreparably corrupted, you may need to drop the doctrine_migrations table and run doctrine:migration:diff followed by make:migration to let Doctrine regenerate the tracking mechanism from scratch. Always back up your database before performing destructive operations on migration tables.

Understanding how Doctrine's metadata caching works is crucial for maintaining a healthy migration workflow. By keeping your cache directories writable, ensuring your migration table exists, and verifying your configuration matches your environment, you can avoid these recurring errors and keep your schema evolution smooth and predictable.

Our network