[flask_migrate] Error: Can't locate revision identified by '6a9f914f656c' 2025-04-15 15:14:01 INFO [alembic.runtime.migration] Context impl PostgresqlImpl. 2025-04-15 15:14:01 INFO [alembic.runtime.migration] Will assume transactional DDL. #12926

Closed
opened 2026-02-21 19:09:43 -05:00 by yindo · 2 comments
Owner

Originally created by @Vampxgg on GitHub (Apr 15, 2025).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.1.3

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

[flask_migrate] Error: Can't locate revision identified by '6a9f914f656c'
2025-04-15 15:14:01 INFO [alembic.runtime.migration] Context impl PostgresqlImpl.
2025-04-15 15:14:01 INFO [alembic.runtime.migration] Will assume transactional DDL.

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @Vampxgg on GitHub (Apr 15, 2025). ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.1.3 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce [flask_migrate] Error: Can't locate revision identified by '6a9f914f656c' 2025-04-15 15:14:01 INFO [alembic.runtime.migration] Context impl PostgresqlImpl. 2025-04-15 15:14:01 INFO [alembic.runtime.migration] Will assume transactional DDL. ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug label 2026-02-21 19:09:43 -05:00
yindo closed this issue 2026-02-21 19:09:43 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Apr 15, 2025):

To resolve the error "Can't locate revision identified by '6a9f914f656c'" when using flask_migrate with PostgresqlImpl in a self-hosted Docker environment, you can follow these steps:

  1. Stop and remove existing containers and volumes:

    docker-compose down -v
    
  2. Rebuild the Docker image without using cache:

    docker-compose build --no-cache
    
  3. Start the containers again:

    docker-compose up -d
    
  4. If the issue persists, try dropping the alembic_version table completely:

    DROP TABLE alembic_version;
    

    Then reinitialize the migrations.

  5. Alternatively, update the version_num in the alembic_version table to match the correct revision for your desired version [1][2].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot[bot] commented on GitHub (Apr 15, 2025): <!-- Answer --> To resolve the error "Can't locate revision identified by '6a9f914f656c'" when using `flask_migrate` with `PostgresqlImpl` in a self-hosted Docker environment, you can follow these steps: 1. Stop and remove existing containers and volumes: ```bash docker-compose down -v ``` 2. Rebuild the Docker image without using cache: ```bash docker-compose build --no-cache ``` 3. Start the containers again: ```bash docker-compose up -d ``` 4. If the issue persists, try dropping the `alembic_version` table completely: ```sql DROP TABLE alembic_version; ``` Then reinitialize the migrations. 5. Alternatively, update the `version_num` in the `alembic_version` table to match the correct revision for your desired version <sup>[[1]](https://github.com/langgenius/dify/issues/15220)</sup><sup>[[2]](https://github.com/langgenius/dify/issues/17067)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/3f35acd7-9708-46d3-8a6f-8e909f495e8f?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/3f35acd7-9708-46d3-8a6f-8e909f495e8f?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/3f35acd7-9708-46d3-8a6f-8e909f495e8f?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/3f35acd7-9708-46d3-8a6f-8e909f495e8f?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/3f35acd7-9708-46d3-8a6f-8e909f495e8f?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/3f35acd7-9708-46d3-8a6f-8e909f495e8f?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/3f35acd7-9708-46d3-8a6f-8e909f495e8f?feedback_type=other)</sup>
Author
Owner

@chadqiu commented on GitHub (Apr 16, 2025):

It works by delete the version in table alembic_version

@chadqiu commented on GitHub (Apr 16, 2025): It works by delete the version in table alembic_version
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#12926