Upgrade to v1.8.0: "panic: runtime error: index out of range" #3217

Closed
opened 2025-11-02 05:04:12 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @lukasbestle on GitHub (Apr 21, 2019).

Description

I've just tried to upgrade from Gitea v1.7.5 to v1.8.0. However, the service won't start. Trace:

$ GITEA_WORK_DIR=/path/to/gitea /path/to/gitea/gitea web
panic: runtime error: index out of range

goroutine 1 [running]:
encoding/base64.(*Encoding).decodeQuantum(0xc0000fe420, 0xc0002575be, 0x2, 0x2, 0xc0000443c0, 0x40, 0x40, 0x2c, 0x0, 0x3cf2300, ...)
	/usr/local/go/src/encoding/base64/base64.go:352 +0x567
encoding/base64.(*Encoding).Decode(0xc0000fe420, 0xc0002575a0, 0x20, 0x20, 0xc0000443c0, 0x40, 0x40, 0x196b106, 0x1, 0xc0002573a0)
	/usr/local/go/src/encoding/base64/base64.go:500 +0x5aa
code.gitea.io/gitea/modules/setting.NewContext()
	/go/src/code.gitea.io/gitea/modules/setting/setting.go:707 +0x4cd5
code.gitea.io/gitea/routers.GlobalInit()
	/go/src/code.gitea.io/gitea/routers/init.go:67 +0x37
code.gitea.io/gitea/cmd.runWeb(0xc0002b5180, 0x0, 0x0)
	/go/src/code.gitea.io/gitea/cmd/web.go:121 +0xa4
code.gitea.io/gitea/vendor/github.com/urfave/cli.HandleAction(0x1758940, 0x19f1fe8, 0xc0002b5180, 0xc0001b0d00, 0x0)
	/go/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/app.go:471 +0xad
code.gitea.io/gitea/vendor/github.com/urfave/cli.Command.Run(0x196bd9a, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x19965cc, 0x16, 0x0, ...)
	/go/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/command.go:191 +0x928
code.gitea.io/gitea/vendor/github.com/urfave/cli.(*App).Run(0xc0005f49c0, 0xc0000ec000, 0x2, 0x2, 0x0, 0x0)
	/go/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/app.go:241 +0x658
main.main()
	/go/src/code.gitea.io/gitea/main.go:57 +0x426
Originally created by @lukasbestle on GitHub (Apr 21, 2019). - Gitea version (or commit ref): v1.8.0 - Git version: 2.16.5 - Operating system: CentOS Linux release 7.6.1810 (Core) - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant - Log gist: No logs generated (log level info) - Config file gist: https://gist.github.com/lukasbestle/989fd13a0363c42bf50a0601b57fab99 ## Description I've just tried to upgrade from Gitea v1.7.5 to v1.8.0. However, the service won't start. Trace: ``` $ GITEA_WORK_DIR=/path/to/gitea /path/to/gitea/gitea web panic: runtime error: index out of range goroutine 1 [running]: encoding/base64.(*Encoding).decodeQuantum(0xc0000fe420, 0xc0002575be, 0x2, 0x2, 0xc0000443c0, 0x40, 0x40, 0x2c, 0x0, 0x3cf2300, ...) /usr/local/go/src/encoding/base64/base64.go:352 +0x567 encoding/base64.(*Encoding).Decode(0xc0000fe420, 0xc0002575a0, 0x20, 0x20, 0xc0000443c0, 0x40, 0x40, 0x196b106, 0x1, 0xc0002573a0) /usr/local/go/src/encoding/base64/base64.go:500 +0x5aa code.gitea.io/gitea/modules/setting.NewContext() /go/src/code.gitea.io/gitea/modules/setting/setting.go:707 +0x4cd5 code.gitea.io/gitea/routers.GlobalInit() /go/src/code.gitea.io/gitea/routers/init.go:67 +0x37 code.gitea.io/gitea/cmd.runWeb(0xc0002b5180, 0x0, 0x0) /go/src/code.gitea.io/gitea/cmd/web.go:121 +0xa4 code.gitea.io/gitea/vendor/github.com/urfave/cli.HandleAction(0x1758940, 0x19f1fe8, 0xc0002b5180, 0xc0001b0d00, 0x0) /go/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/app.go:471 +0xad code.gitea.io/gitea/vendor/github.com/urfave/cli.Command.Run(0x196bd9a, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x19965cc, 0x16, 0x0, ...) /go/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/command.go:191 +0x928 code.gitea.io/gitea/vendor/github.com/urfave/cli.(*App).Run(0xc0005f49c0, 0xc0000ec000, 0x2, 0x2, 0x0, 0x0) /go/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/app.go:241 +0x658 main.main() /go/src/code.gitea.io/gitea/main.go:57 +0x426 ```
Author
Owner

@lunny commented on GitHub (Apr 21, 2019):

I can reproduce that when you filled your oauth2.JWT_SECRET with more than 43 charactors. You could let it blank and Gitea will generate it automatically.

@lunny commented on GitHub (Apr 21, 2019): I can reproduce that when you filled your `oauth2.JWT_SECRET` with more than 43 charactors. You could let it blank and Gitea will generate it automatically.
Author
Owner

@lukasbestle commented on GitHub (Apr 21, 2019):

Indeed, that was it. Thanks for your fast and helpful reply. :)

I can't let Gitea generate the secret keys automatically unfortunately, as I'm using Ansible to manage the installation and any change to the config file by Gitea will be overwritten automatically on the next update.

It would be awesome if all those secret keys were configured in a separate config file (like custom/conf/keys.ini). Then I could just leave that file alone and it would be managed by Gitea entirely.

@lukasbestle commented on GitHub (Apr 21, 2019): Indeed, that was it. Thanks for your fast and helpful reply. :) I can't let Gitea generate the secret keys automatically unfortunately, as I'm using Ansible to manage the installation and any change to the config file by Gitea will be overwritten automatically on the next update. It would be awesome if all those secret keys were configured in a separate config file (like `custom/conf/keys.ini`). Then I could just leave that file alone and it would be managed by Gitea entirely.
Author
Owner

@lunny commented on GitHub (Apr 21, 2019):

And you can generate the secret via ./gitea generate

@lunny commented on GitHub (Apr 21, 2019): And you can generate the secret via `./gitea generate`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#3217