Wiki creation returns 500 when project's default branch is not master. #7656

Closed
opened 2025-11-02 07:32:37 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @jkiv on GitHub (Aug 4, 2021).

  • Gitea version: 1.15.0+rc2
  • Git version: 2.25.1
  • Ubuntu Server 20.04LTS (Linux 5.8.0-1039-azure 42~20.04.1-Ubuntu SMP x86_64)
  • Running Gitea in Docker. Followed docker-compose instructions.
  • Using PostgreSQL version 13.3 (Debian 13.3-1.pgdg100+1)

Symptoms

I've been playing around with Gitea on a local VM.

I created an empty repository called "Test" and set the default branch to "main".

I immediately tried to create a WIki and add a page. I used the default body "Welcome to the Wiki." However, the page title was not populated by default. I named the page "Home" and clicked "Save page".

This produced a page that read "500" and the attached error messages.

I was not able to reproduce on try.gitea.io.

Logs

The resulting log output:

2021/08/04 10:20:44 Started POST /jkiv/Test/wiki/_new for 172.19.0.1:46174
2021/08/04 10:20:44 ...ervices/wiki/wiki.go:93:prepareWikiFileName() [E] exit status 128 - fatal: Not a valid object name master
	
2021/08/04 10:20:44 ...ers/web/repo/wiki.go:616:NewWikiPost() [E] AddWikiPage: exit status 128 - fatal: Not a valid object name master
	
2021/08/04 10:20:44 Completed POST /jkiv/Test/wiki/_new 500 Internal Server Error in 28.04429ms

docker-compose.yml:

The docker-compose.yml:

version: "3"

networks:
  gitea:
    external: false

services:
  server:
    image: gitea/gitea:latest
    container_name: gitea
    environment:
      - USER_UID=13000
      - USER_GID=13000
      - GITEA__database__DB_TYPE=postgres
      - GITEA__database__HOST=db:5432
      - GITEA__database__NAME=gitea
      - GITEA__database__USER=gitea
      - GITEA__database__PASSWD=gitea
    restart: always
    networks:
      - gitea
    volumes:
      - /opt/gitea/data:/data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    ports:
      - "3000:3000"
      - "2222:22"
    depends_on:
      - db

  db:
    image: postgres:13
    restart: always
    environment:
      - POSTGRES_USER=gitea
      - POSTGRES_PASSWORD=gitea
      - POSTGRES_DB=gitea
    networks:
      - gitea
    volumes:
      - /opt/gitea/postgres:/var/lib/postgresql/data

app.ini

The app.ini with secrets intentionally removed

APP_NAME = GITEA
RUN_MODE = prod
RUN_USER = git

[repository]
ROOT = /data/git/repositories

[repository.local]
LOCAL_COPY_PATH = /data/gitea/tmp/local-repo

[repository.upload]
TEMP_PATH = /data/gitea/uploads

[server]
APP_DATA_PATH    = /data/gitea
DOMAIN           = localhost
SSH_DOMAIN       = localhost
HTTP_PORT        = 3000
ROOT_URL         = http://gitea/
DISABLE_SSH      = false
SSH_PORT         = 22
SSH_LISTEN_PORT  = 22
LFS_START_SERVER = true
LFS_CONTENT_PATH = /data/git/lfs
LFS_JWT_SECRET   = <removed>
OFFLINE_MODE     = true

[database]
PATH     = /data/gitea/gitea.db
DB_TYPE  = postgres
HOST     = db:5432
NAME     = gitea
USER     = gitea
PASSWD   = gitea
LOG_SQL  = false
SCHEMA   = 
SSL_MODE = disable
CHARSET  = utf8

[indexer]
ISSUE_INDEXER_PATH = /data/gitea/indexers/issues.bleve

[session]
PROVIDER_CONFIG = /data/gitea/sessions
PROVIDER        = file

[picture]
AVATAR_UPLOAD_PATH            = /data/gitea/avatars
REPOSITORY_AVATAR_UPLOAD_PATH = /data/gitea/repo-avatars
DISABLE_GRAVATAR              = true
ENABLE_FEDERATED_AVATAR       = false

[attachment]
PATH = /data/gitea/attachments

[log]
MODE      = console
LEVEL     = info
ROUTER    = console
ROOT_PATH = /data/gitea/log

[security]
INSTALL_LOCK                  = true
SECRET_KEY                    = <removed>
REVERSE_PROXY_LIMIT           = 1
REVERSE_PROXY_TRUSTED_PROXIES = *
INTERNAL_TOKEN                = <removed>
PASSWORD_HASH_ALGO            = pbkdf2

[service]
DISABLE_REGISTRATION              = false
REQUIRE_SIGNIN_VIEW               = false
REGISTER_EMAIL_CONFIRM            = false
ENABLE_NOTIFY_MAIL                = false
ALLOW_ONLY_EXTERNAL_REGISTRATION  = true
ENABLE_CAPTCHA                    = false
DEFAULT_KEEP_EMAIL_PRIVATE        = false
DEFAULT_ALLOW_CREATE_ORGANIZATION = false
DEFAULT_ENABLE_TIMETRACKING       = true
NO_REPLY_ADDRESS                  = hidden.gitea.hyperv.local

[mailer]
ENABLED = false

[openid]
ENABLE_OPENID_SIGNIN = false
ENABLE_OPENID_SIGNUP = false

Screenshots

The repo:

1

Creating the wiki:

2

No default title (unlike try.gitea.io):

3

Before submitting:

4

After submitting:

5

Originally created by @jkiv on GitHub (Aug 4, 2021). * Gitea version: 1.15.0+rc2 * Git version: 2.25.1 * Ubuntu Server 20.04LTS (Linux 5.8.0-1039-azure 42~20.04.1-Ubuntu SMP x86_64) * Running Gitea in Docker. Followed `docker-compose` [instructions](https://docs.gitea.io/en-us/install-with-docker/). * Using PostgreSQL version 13.3 (Debian 13.3-1.pgdg100+1) ## Symptoms I've been playing around with Gitea on a local VM. I created an empty repository called "Test" and set the default branch to "main". I immediately tried to create a WIki and add a page. I used the default body "Welcome to the Wiki." However, the page title was not populated by default. I named the page "Home" and clicked "Save page". This produced a page that read "500" and the attached error messages. I was not able to reproduce on `try.gitea.io`. ## Logs The resulting log output: ``` 2021/08/04 10:20:44 Started POST /jkiv/Test/wiki/_new for 172.19.0.1:46174 2021/08/04 10:20:44 ...ervices/wiki/wiki.go:93:prepareWikiFileName() [E] exit status 128 - fatal: Not a valid object name master 2021/08/04 10:20:44 ...ers/web/repo/wiki.go:616:NewWikiPost() [E] AddWikiPage: exit status 128 - fatal: Not a valid object name master 2021/08/04 10:20:44 Completed POST /jkiv/Test/wiki/_new 500 Internal Server Error in 28.04429ms ``` ## `docker-compose.yml`: The `docker-compose.yml`: ```yaml version: "3" networks: gitea: external: false services: server: image: gitea/gitea:latest container_name: gitea environment: - USER_UID=13000 - USER_GID=13000 - GITEA__database__DB_TYPE=postgres - GITEA__database__HOST=db:5432 - GITEA__database__NAME=gitea - GITEA__database__USER=gitea - GITEA__database__PASSWD=gitea restart: always networks: - gitea volumes: - /opt/gitea/data:/data - /etc/timezone:/etc/timezone:ro - /etc/localtime:/etc/localtime:ro ports: - "3000:3000" - "2222:22" depends_on: - db db: image: postgres:13 restart: always environment: - POSTGRES_USER=gitea - POSTGRES_PASSWORD=gitea - POSTGRES_DB=gitea networks: - gitea volumes: - /opt/gitea/postgres:/var/lib/postgresql/data ``` ## `app.ini` The `app.ini` with secrets intentionally removed ```ini APP_NAME = GITEA RUN_MODE = prod RUN_USER = git [repository] ROOT = /data/git/repositories [repository.local] LOCAL_COPY_PATH = /data/gitea/tmp/local-repo [repository.upload] TEMP_PATH = /data/gitea/uploads [server] APP_DATA_PATH = /data/gitea DOMAIN = localhost SSH_DOMAIN = localhost HTTP_PORT = 3000 ROOT_URL = http://gitea/ DISABLE_SSH = false SSH_PORT = 22 SSH_LISTEN_PORT = 22 LFS_START_SERVER = true LFS_CONTENT_PATH = /data/git/lfs LFS_JWT_SECRET = <removed> OFFLINE_MODE = true [database] PATH = /data/gitea/gitea.db DB_TYPE = postgres HOST = db:5432 NAME = gitea USER = gitea PASSWD = gitea LOG_SQL = false SCHEMA = SSL_MODE = disable CHARSET = utf8 [indexer] ISSUE_INDEXER_PATH = /data/gitea/indexers/issues.bleve [session] PROVIDER_CONFIG = /data/gitea/sessions PROVIDER = file [picture] AVATAR_UPLOAD_PATH = /data/gitea/avatars REPOSITORY_AVATAR_UPLOAD_PATH = /data/gitea/repo-avatars DISABLE_GRAVATAR = true ENABLE_FEDERATED_AVATAR = false [attachment] PATH = /data/gitea/attachments [log] MODE = console LEVEL = info ROUTER = console ROOT_PATH = /data/gitea/log [security] INSTALL_LOCK = true SECRET_KEY = <removed> REVERSE_PROXY_LIMIT = 1 REVERSE_PROXY_TRUSTED_PROXIES = * INTERNAL_TOKEN = <removed> PASSWORD_HASH_ALGO = pbkdf2 [service] DISABLE_REGISTRATION = false REQUIRE_SIGNIN_VIEW = false REGISTER_EMAIL_CONFIRM = false ENABLE_NOTIFY_MAIL = false ALLOW_ONLY_EXTERNAL_REGISTRATION = true ENABLE_CAPTCHA = false DEFAULT_KEEP_EMAIL_PRIVATE = false DEFAULT_ALLOW_CREATE_ORGANIZATION = false DEFAULT_ENABLE_TIMETRACKING = true NO_REPLY_ADDRESS = hidden.gitea.hyperv.local [mailer] ENABLED = false [openid] ENABLE_OPENID_SIGNIN = false ENABLE_OPENID_SIGNUP = false ``` ## Screenshots The repo: ![1](https://user-images.githubusercontent.com/226881/128168171-045ab00f-3e69-4048-a94e-aa224548d60d.PNG) Creating the wiki: ![2](https://user-images.githubusercontent.com/226881/128168183-8ad8cb93-091b-42f5-9556-54e1c107815c.PNG) No default title (unlike `try.gitea.io`): ![3](https://user-images.githubusercontent.com/226881/128168193-db805390-9da8-4ace-b840-72660a119133.PNG) Before submitting: ![4](https://user-images.githubusercontent.com/226881/128168195-62f5589a-c34d-45da-a3f1-e58a77372f81.PNG) After submitting: ![5](https://user-images.githubusercontent.com/226881/128168198-df777fc5-47c0-417b-bcd3-87ce75582915.PNG)
GiteaMirror added the issue/duplicate label 2025-11-02 07:32:37 -06:00
Author
Owner

@zeripath commented on GitHub (Aug 4, 2021):

Fixed by #16586 and its backport #16598 which will be in rc3.

@zeripath commented on GitHub (Aug 4, 2021): Fixed by #16586 and its backport #16598 which will be in rc3.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#7656