Skip to content

Cannot merge pull request #35603

@badhezi

Description

@badhezi

Description

Needs feedback
Can't seem to merge a pull request

When creating a simple pull request from the UI and then trying to "create merge commit"
gitea server errors out with below log

Possibly introduced by this commit 69f5ee9

panic("stdout and stderr field must be nil when using RunStdBytes")

panics because c.opts.Stdout and c.opts.Stderr and not nil

if c.opts.Stdout != nil || c.opts.Stderr != nil {

Debugger shows c.opts.Stdout and c.opts.Stderr are not nil and are initialized to
io.Writer(*strings.Builder) *{addr: *strings.Builder nil, buf: []uint8 len: 0, cap: 0, nil}

Image

Gitea Version

main 03fce8f

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

Image

logs:

2025/10/08 15:42:56 HTTPRequest [W] router: failed POST /gitea_admin/merge-me/pulls/1/merge for [::1]:57214, panic in 212.7ms @ repo/pull.go:1014(repo.MergePullRequest), err=stdout and stderr field must be nil when using RunStdBytes 2025/10/08 15:42:56 routers/common/errpage.go:25:RenderPanicErrorPage() [E] PANIC: stdout and stderr field must be nil when using RunStdBytes /usr/local/go/src/runtime/panic.go:783 (0x10090eaff) gopanic: fn() /Users/heziaharon/Documents/repos/gitea/modules/web/routing/logger_manager.go:116 (0x1019792cb) (*requestRecordsManager).handler-fm.(*requestRecordsManager).handler.func1.1: panic(localPanicErr) /usr/local/go/src/runtime/panic.go:783 (0x10090eaff) gopanic: fn() /Users/heziaharon/Documents/repos/gitea/modules/git/gitcmd/command.go:473 (0x101139cf3) (*Command).runStdBytes: panic("stdout and stderr field must be nil when using RunStdBytes") /Users/heziaharon/Documents/repos/gitea/modules/git/gitcmd/command.go:461 (0x1011399cb) (*Command).RunStdString: stdoutBytes, stderrBytes, runErr := c.WithParentCallerInfo().runStdBytes(ctx) /Users/heziaharon/Documents/repos/gitea/services/pull/merge_prepare.go:76 (0x102048387) createTemporaryRepoForMerge: trackingCommitID, _, err := mergeCtx.PrepareGitCmd(gitcmd.NewCommand("show-ref", "--hash").AddDynamicArguments(git.BranchPrefix + trackingBranch)).RunStdString(ctx) /Users/heziaharon/Documents/repos/gitea/services/pull/merge.go:331 (0x102044047) doMergeAndPush: mergeCtx, cancel, err := createTemporaryRepoForMerge(ctx, pr, doer, expectedHeadCommitID) /Users/heziaharon/Documents/repos/gitea/services/pull/merge.go:262 (0x102043853) Merge: _, err = doMergeAndPush(ctx, pr, doer, mergeStyle, expectedHeadCommitID, message, repo_module.PushTriggerPRMergeToBase) /Users/heziaharon/Documents/repos/gitea/routers/web/repo/pull.go:1115 (0x1029938c3) MergePullRequest: if err := pull_service.Merge(ctx, pr, ctx.Doer, ctx.Repo.GitRepo, repo_model.MergeStyle(form.Do), form.HeadCommitID, message, false); err != nil { /usr/local/go/src/reflect/value.go:581 (0x10099508f) Value.call: call(frametype, fn, stackArgs, uint32(frametype.Size()), uint32(abid.retOffset), uint32(frameSize), &regArgs) /usr/local/go/src/reflect/value.go:365 (0x100994563) Value.Call: return v.call("Call", in) /Users/heziaharon/Documents/repos/gitea/modules/web/handler.go:161 (0x101981467) toHandlerProvider.func1.1: ret := fn.Call(argsIn) /usr/local/go/src/net/http/server.go:2322 (0x100d72017) HandlerFunc.ServeHTTP: f(w, r) /usr/local/go/src/net/http/server.go:2322 (0x100d72017) HandlerFunc.ServeHTTP: f(w, r) /Users/heziaharon/Documents/repos/gitea/modules/web/handler.go:168 (0x1019814bb) toHandlerProvider.func1.1: next.ServeHTTP(resp, req) /usr/local/go/src/net/http/server.go:2322 (0x100d72017) HandlerFunc.ServeHTTP: f(w, r) /Users/heziaharon/Documents/repos/gitea/modules/web/handler.go:168 (0x1019814bb) toHandlerProvider.func1.1: next.ServeHTTP(resp, req) /usr/local/go/src/net/http/server.go:2322 (0x100d72017) HandlerFunc.ServeHTTP: f(w, r) /Users/heziaharon/Documents/repos/gitea/modules/web/handler.go:168 (0x1019814bb) toHandlerProvider.func1.1: next.ServeHTTP(resp, req) /usr/local/go/src/net/http/server.go:2322 (0x100d72017) HandlerFunc.ServeHTTP: f(w, r) /Users/heziaharon/Documents/repos/gitea/modules/web/handler.go:168 (0x1019814bb) toHandlerProvider.func1.1: next.ServeHTTP(resp, req) /usr/local/go/src/net/http/server.go:2322 (0x100d72017) HandlerFunc.ServeHTTP: f(w, r) /Users/heziaharon/Documents/repos/gitea/modules/web/handler.go:168 (0x1019814bb) toHandlerProvider.func1.1: next.ServeHTTP(resp, req) /usr/local/go/src/net/http/server.go:2322 (0x100d72017) HandlerFunc.ServeHTTP: f(w, r) /Users/heziaharon/Documents/repos/gitea/modules/web/handler.go:168 (0x1019814bb) toHandlerProvider.func1.1: next.ServeHTTP(resp, req) /usr/local/go/src/net/http/server.go:2322 (0x100d72017) HandlerFunc.ServeHTTP: f(w, r) /Users/heziaharon/go/pkg/mod/github.com/go-chi/chi/v5@v5.2.3/chain.go:31 (0x101979b8b) (*ChainHandler).ServeHTTP: c.chain.ServeHTTP(w, r) /Users/heziaharon/go/pkg/mod/github.com/go-chi/chi/v5@v5.2.3/mux.go:477 (0x10197c66b) (*Mux).routeHTTP: h.ServeHTTP(w, r) /usr/local/go/src/net/http/server.go:2322 (0x100d72017) HandlerFunc.ServeHTTP: f(w, r) /Users/heziaharon/Documents/repos/gitea/modules/web/handler.go:168 (0x1019814bb) toHandlerProvider.func1.1: next.ServeHTTP(resp, req) /usr/local/go/src/net/http/server.go:2322 (0x100d72017) HandlerFunc.ServeHTTP: f(w, r) /Users/heziaharon/Documents/repos/gitea/modules/web/handler.go:168 (0x1019814bb) toHandlerProvider.func1.1: next.ServeHTTP(resp, req) /usr/local/go/src/net/http/server.go:2322 (0x100d72017) HandlerFunc.ServeHTTP: f(w, r) /Users/heziaharon/go/pkg/mod/github.com/go-chi/chi/v5@v5.2.3/middleware/get_head.go:37 (0x1029176a7) GetHead.func1: next.ServeHTTP(w, r) /usr/local/go/src/net/http/server.go:2322 (0x100d72017) HandlerFunc.ServeHTTP: f(w, r) /Users/heziaharon/Documents/repos/gitea/modules/web/handler.go:125 (0x101981883) toHandlerProvider.wrapHandlerProvider[...].func2.1: h.ServeHTTP(resp, req) /usr/local/go/src/net/http/server.go:2322 (0x100d72017) HandlerFunc.ServeHTTP: f(w, r) /Users/heziaharon/Documents/repos/gitea/modules/web/handler.go:168 (0x1019814bb) toHandlerProvider.func1.1: next.ServeHTTP(resp, req) /usr/local/go/src/net/http/server.go:2322 (0x100d72017) HandlerFunc.ServeHTTP: f(w, r) /Users/heziaharon/Documents/repos/gitea/services/context/context.go:210 (0x101ed05b3) Contexter.func1.1: next.ServeHTTP(ctx.Resp, ctx.Req) /usr/local/go/src/net/http/server.go:2322 (0x100d72017) HandlerFunc.ServeHTTP: f(w, r) /Users/heziaharon/Documents/repos/gitea/modules/web/handler.go:125 (0x101981883) toHandlerProvider.wrapHandlerProvider[...].func2.1: h.ServeHTTP(resp, req) /usr/local/go/src/net/http/server.go:2322 (0x100d72017) HandlerFunc.ServeHTTP: f(w, r) /Users/heziaharon/go/pkg/mod/gitea.com/go-chi/session@v0.0.0-20250926004215-636cadd82e15/session.go:257 (0x10192bc0b) Sessioner.func1.1: next.ServeHTTP(w, req) /usr/local/go/src/net/http/server.go:2322 (0x100d72017) HandlerFunc.ServeHTTP: f(w, r) /Users/heziaharon/Documents/repos/gitea/modules/web/handler.go:125 (0x101981883) toHandlerProvider.wrapHandlerProvider[...].func2.1: h.ServeHTTP(resp, req) /usr/local/go/src/net/http/server.go:2322 (0x100d72017) HandlerFunc.ServeHTTP: f(w, r) /Users/heziaharon/go/pkg/mod/github.com/go-chi/chi/v5@v5.2.3/mux.go:73 (0x10197a663) (*Mux).ServeHTTP: mx.handler.ServeHTTP(w, r) /Users/heziaharon/go/pkg/mod/github.com/go-chi/chi/v5@v5.2.3/mux.go:321 (0x10197bc53) (*Mux).Mount.func1: handler.ServeHTTP(w, r) /usr/local/go/src/net/http/server.go:2322 (0x100d72017) HandlerFunc.ServeHTTP: f(w, r) /Users/heziaharon/go/pkg/mod/github.com/go-chi/chi/v5@v5.2.3/mux.go:477 (0x10197c66b) (*Mux).routeHTTP: h.ServeHTTP(w, r) /usr/local/go/src/net/http/server.go:2322 (0x100d72017) HandlerFunc.ServeHTTP: f(w, r) /Users/heziaharon/go/pkg/mod/github.com/go-chi/chi/v5@v5.2.3/mux.go:73 (0x10197a663) (*Mux).ServeHTTP: mx.handler.ServeHTTP(w, r) /Users/heziaharon/go/pkg/mod/github.com/go-chi/chi/v5@v5.2.3/mux.go:321 (0x10197bc53) (*Mux).Mount.func1: handler.ServeHTTP(w, r) /usr/local/go/src/net/http/server.go:2322 (0x100d72017) HandlerFunc.ServeHTTP: f(w, r) /Users/heziaharon/go/pkg/mod/github.com/go-chi/chi/v5@v5.2.3/mux.go:477 (0x10197c66b) (*Mux).routeHTTP: h.ServeHTTP(w, r) /usr/local/go/src/net/http/server.go:2322 (0x100d72017) HandlerFunc.ServeHTTP: f(w, r) /Users/heziaharon/Documents/repos/gitea/modules/web/routing/logger_manager.go:122 (0x101979187) (*requestRecordsManager).handler-fm.(*requestRecordsManager).handler.func1: next.ServeHTTP(w, req) /usr/local/go/src/net/http/server.go:2322 (0x100d72017) HandlerFunc.ServeHTTP: f(w, r) /Users/heziaharon/Documents/repos/gitea/modules/web/handler.go:125 (0x101981883) toHandlerProvider.wrapHandlerProvider[...].func2.1: h.ServeHTTP(resp, req) /usr/local/go/src/net/http/server.go:2322 (0x100d72017) HandlerFunc.ServeHTTP: f(w, r) /Users/heziaharon/go/pkg/mod/github.com/chi-middleware/proxy@v1.1.1/middleware.go:37 (0x10287523b) ForwardedHeadersHandler.ForwardedHeaders.func1.1: h.ServeHTTP(w, r) /usr/local/go/src/net/http/server.go:2322 (0x100d72017) HandlerFunc.ServeHTTP: f(w, r) /Users/heziaharon/Documents/repos/gitea/modules/web/handler.go:125 (0x101981883) toHandlerProvider.wrapHandlerProvider[...].func2.1: h.ServeHTTP(resp, req) /usr/local/go/src/net/http/server.go:2322 (0x100d72017) HandlerFunc.ServeHTTP: f(w, r) /Users/heziaharon/Documents/repos/gitea/routers/common/middleware.go:78 (0x1028774df) ProtocolMiddlewares.RequestContextHandler.func2.1: next.ServeHTTP(respWriter, req) /usr/local/go/src/net/http/server.go:2322 (0x100d72017) HandlerFunc.ServeHTTP: f(w, r) /Users/heziaharon/Documents/repos/gitea/modules/web/handler.go:125 (0x101981883) toHandlerProvider.wrapHandlerProvider[...].func2.1: h.ServeHTTP(resp, req) /usr/local/go/src/net/http/server.go:2322 (0x100d72017) HandlerFunc.ServeHTTP: f(w, r) /Users/heziaharon/Documents/repos/gitea/routers/common/middleware.go:93 (0x10287713b) ProtocolMiddlewares.ChiRoutePathHandler.func1.1: next.ServeHTTP(resp, req) /usr/local/go/src/net/http/server.go:2322 (0x100d72017) HandlerFunc.ServeHTTP: f(w, r) /Users/heziaharon/Documents/repos/gitea/modules/web/handler.go:125 (0x101981883) toHandlerProvider.wrapHandlerProvider[...].func2.1: h.ServeHTTP(resp, req) /usr/local/go/src/net/http/server.go:2322 (0x100d72017) HandlerFunc.ServeHTTP: f(w, r) /Users/heziaharon/go/pkg/mod/github.com/go-chi/chi/v5@v5.2.3/mux.go:90 (0x10197a623) (*Mux).ServeHTTP: mx.handler.ServeHTTP(w, r) /Users/heziaharon/Documents/repos/gitea/modules/web/router.go:243 (0x10198306b) (*Router).normalizeRequestPath: next.ServeHTTP(resp, req) /Users/heziaharon/Documents/repos/gitea/modules/web/router.go:181 (0x101982b6f) (*Router).ServeHTTP: r.normalizeRequestPath(w, req, r.chiRouter) /usr/local/go/src/net/http/server.go:3340 (0x100d8f1ff) serverHandler.ServeHTTP: handler.ServeHTTP(rw, req) /usr/local/go/src/net/http/server.go:2109 (0x100d70407) (*conn).serve: serverHandler{c.server}.ServeHTTP(w, w.req) /usr/local/go/src/runtime/asm_arm64.s:1268 (0x100917503) goexit: MOVD R0, R0 // NOP 

Git Version

2.39.5

Operating System

macos

How are you running Gitea?

Local setup make watch

Database

PostgreSQL

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions