Gitea fails to start: Failed to initialize ORM engine: sync database struct error: Error 1265: Data truncated for column 'theme' at row 1 #2730

Closed
opened 2025-11-02 04:45:50 -06:00 by GiteaMirror · 13 comments
Owner

Originally created by @wyattoday on GitHub (Jan 9, 2019).

  • Gitea version (or commit ref): dd13327382
  • Git version: Latest
  • Operating system: Linux
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

2019/01/09 16:43:38 [...itea/routers/init.go:61 GlobalInit()] [E] Failed to initialize ORM engine: sync database struct error: Error 1265: Data truncated for column 'theme' at row 1
2019/01/09 16:43:39 [...itea/routers/init.go:61 GlobalInit()] [E] Failed to initialize ORM engine: sync database struct error: Error 1265: Data truncated for column 'theme' at row 1
2019/01/09 16:43:39 [...itea/routers/init.go:61 GlobalInit()] [E] Failed to initialize ORM engine: sync database struct error: Error 1265: Data truncated for column 'theme' at row 1
2019/01/09 16:43:40 [...itea/routers/init.go:61 GlobalInit()] [E] Failed to initialize ORM engine: sync database struct error: Error 1265: Data truncated for column 'theme' at row 1
2019/01/09 16:43:40 [...itea/routers/init.go:61 GlobalInit()] [E] Failed to initialize ORM engine: sync database struct error: Error 1265: Data truncated for column 'theme' at row 1

Description

Using the latest gitea version fails to start. Likely due to changes not being made to the database.

Screenshots

Originally created by @wyattoday on GitHub (Jan 9, 2019). - Gitea version (or commit ref): https://github.com/go-gitea/gitea/commit/dd13327382f76b7a5d2b5e98e75a6aaa9a67c313 - Git version: Latest - Operating system: Linux - Database (use `[x]`): - [ ] PostgreSQL - [x] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [x] No - [ ] Not relevant - Log gist: 2019/01/09 16:43:38 [...itea/routers/init.go:61 GlobalInit()] [E] Failed to initialize ORM engine: sync database struct error: Error 1265: Data truncated for column 'theme' at row 1 2019/01/09 16:43:39 [...itea/routers/init.go:61 GlobalInit()] [E] Failed to initialize ORM engine: sync database struct error: Error 1265: Data truncated for column 'theme' at row 1 2019/01/09 16:43:39 [...itea/routers/init.go:61 GlobalInit()] [E] Failed to initialize ORM engine: sync database struct error: Error 1265: Data truncated for column 'theme' at row 1 2019/01/09 16:43:40 [...itea/routers/init.go:61 GlobalInit()] [E] Failed to initialize ORM engine: sync database struct error: Error 1265: Data truncated for column 'theme' at row 1 2019/01/09 16:43:40 [...itea/routers/init.go:61 GlobalInit()] [E] Failed to initialize ORM engine: sync database struct error: Error 1265: Data truncated for column 'theme' at row 1 ## Description Using the latest gitea version fails to start. Likely due to changes not being made to the database. ## Screenshots <!-- **If this issue involves the Web Interface, please include a screenshot** -->
GiteaMirror added the type/bug label 2025-11-02 04:45:50 -06:00
Author
Owner

@techknowlogick commented on GitHub (Jan 9, 2019):

Ping @adelowo

@techknowlogick commented on GitHub (Jan 9, 2019): Ping @adelowo
Author
Owner

@adelowo commented on GitHub (Jan 9, 2019):

Taking a look at this right now.

@wyattoday what version of MySQL are you running? I cannot replicate this on 5.7.20? And is this a fresh database or a previously used one?

@adelowo commented on GitHub (Jan 9, 2019): Taking a look at this right now. @wyattoday what version of MySQL are you running? I cannot replicate this on `5.7.20`? And is this a fresh database or a previously used one?
Author
Owner

@wyattoday commented on GitHub (Jan 9, 2019):

MySQL 8.0.13, upgrading from the gitea commit previous to the “theme commit” to a commit after the “theme commit”

@wyattoday commented on GitHub (Jan 9, 2019): MySQL 8.0.13, upgrading from the gitea commit previous to the “theme commit” to a commit after the “theme commit”
Author
Owner

@adelowo commented on GitHub (Jan 9, 2019):

Thanks for the heads up

@adelowo commented on GitHub (Jan 9, 2019): Thanks for the heads up
Author
Owner

@kimpenhaus commented on GitHub (Jan 9, 2019):

Having the same issue with the latest docker container - updated by watchtower (so also a previously used one). Running against 10.3.7-MariaDB. It's a previously used db

@kimpenhaus commented on GitHub (Jan 9, 2019): Having the same issue with the latest docker container - updated by watchtower (so also a previously used one). Running against `10.3.7-MariaDB`. It's a previously used db
Author
Owner

@adelowo commented on GitHub (Jan 9, 2019):

Sorry folks, I'm getting to my computer in a few minutes and will pull down an 8.X MySQL image to test and submit a patch.

@adelowo commented on GitHub (Jan 9, 2019): Sorry folks, I'm getting to my computer in a few minutes and will pull down an `8.X` MySQL image to test and submit a patch.
Author
Owner

@kimpenhaus commented on GitHub (Jan 9, 2019):

I've found a workaround to get my container up and running. The theme entries of all users inside the db had NULL value. Updating that value to gitea (as default) fixed it for me. I guess the migration alters the column to NOT NULL without respecting existing data?

@kimpenhaus commented on GitHub (Jan 9, 2019): I've found a workaround to get my container up and running. The `theme` entries of all users inside the db had `NULL` value. Updating that value to `gitea` (as default) fixed it for me. I guess the migration alters the column to `NOT NULL` without respecting existing data?
Author
Owner

@adelowo commented on GitHub (Jan 9, 2019):

Yeah, I believe that is the fix, but I want to test on a 8.X Mysql DB before doing anything. Downloading the docker image right now

@adelowo commented on GitHub (Jan 9, 2019): Yeah, I believe that is the fix, but I want to test on a 8.X Mysql DB before doing anything. Downloading the docker image right now
Author
Owner

@adelowo commented on GitHub (Jan 9, 2019):

I didn't want to set gitea as the default so as not to interfere with the value of DEFAULT_THEME if set

31aa00fa4b/models/user.go (L170-L175)

@adelowo commented on GitHub (Jan 9, 2019): I didn't want to set `gitea` as the default so as not to interfere with the value of `DEFAULT_THEME` if set https://github.com/go-gitea/gitea/blob/31aa00fa4b6a5e77b5bd4d29628860ff88eb4029/models/user.go#L170-L175
Author
Owner

@adelowo commented on GitHub (Jan 9, 2019):

Note to self --- Always Test on 5.X and 8.X

@adelowo commented on GitHub (Jan 9, 2019): Note to self --- Always Test on 5.X and 8.X
Author
Owner

@securitaas commented on GitHub (Jan 17, 2019):

Same for me. Setting the default theme to "gitea" for all users works.

@securitaas commented on GitHub (Jan 17, 2019): Same for me. Setting the default theme to "gitea" for all users works.
Author
Owner

@adelowo commented on GitHub (Jan 17, 2019):

@securitaas What commit are you running? This was fixed in
https://github.com/go-gitea/gitea/pull/5682

@adelowo commented on GitHub (Jan 17, 2019): @securitaas What commit are you running? This was fixed in https://github.com/go-gitea/gitea/pull/5682
Author
Owner

@tokidoki11 commented on GitHub (Jun 26, 2019):

Hi, I have the some problem when trying to update from 1.7.1 to 1.8.3
Database is mysql 8.0.12

The latest entry on log is
[...itea/routers/init.go:84 GlobalInit()] [E] ORM engine initialization failed: sync database struct error: Error 1265: Data truncated for column 'theme' at row 1

@tokidoki11 commented on GitHub (Jun 26, 2019): Hi, I have the some problem when trying to update from 1.7.1 to 1.8.3 Database is mysql 8.0.12 The latest entry on log is ```[...itea/routers/init.go:84 GlobalInit()] [E] ORM engine initialization failed: sync database struct error: Error 1265: Data truncated for column 'theme' at row 1```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#2730