Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 2, 2025

Two endpoints return 400 errors after upgrade to 2.16.35/36:

  • /api/project/{id}/views: gorp: no fields [hidden type filter sort_column sort_reverse] in type View
  • /api/project/{id}/repositories/{id}/branches: chdir /tmp/semaphore/project_1: no such file or directory

Changes

View struct (db/View.go)

  • Added optional nullable fields to handle extra database columns that may exist in some installations (pro version, manual migrations):
    Hidden *bool `db:"hidden" json:"hidden,omitempty"` Type *string `db:"type" json:"type,omitempty"` Filter *string `db:"filter" json:"filter,omitempty"` SortColumn *string `db:"sort_column" json:"sort_column,omitempty"` SortReverse *bool `db:"sort_reverse" json:"sort_reverse,omitempty"`
    Allows gorp to map these columns when present without breaking standard installations.

Git client (db_lib/CmdGitClient.go)

  • Create project tmp directory if it doesn't exist before executing git commands
  • Log errors on directory creation failure for debugging
  • Commands like ls-remote don't need a local repo but still require a working directory to execute
Original prompt

This section details on the original issue you should resolve

<issue_title>Problem: Multiple APIs Return 400 since Update to 2.16.35/2.16.36</issue_title>
<issue_description>### Issue

For example the Endpoint /api/project/1/views on my Instance returns with Error 400 since the latest update, wich makes the GUI mostly unusable.

/api/project/1/views 400

semaphore-1 | time="2025-10-29T18:18:54Z" level=error msg="gorp: no fields [hidden type filter sort_column sort_reverse] in type View" semaphore-1 | goroutine 42 [running]: semaphore-1 | runtime/debug.Stack() semaphore-1 | /usr/local/go/src/runtime/debug/stack.go:26 +0x5e semaphore-1 | runtime/debug.PrintStack() semaphore-1 | /usr/local/go/src/runtime/debug/stack.go:18 +0x13 semaphore-1 | github.com/semaphoreui/semaphore/api/helpers.WriteError({0x2957410, 0xc000000000}, {0x29520e0, 0xc0003d0d50}) semaphore-1 | /go/src/semaphore/api/helpers/write_response.go:52 +0x192 semaphore-1 | github.com/semaphoreui/semaphore/api/projects.GetViews({0x2957410, 0xc000000000}, 0xc000559680) semaphore-1 | /go/src/semaphore/api/projects/views.go:60 +0x265 semaphore-1 | net/http.HandlerFunc.ServeHTTP(0xc0004e7460?, {0x2957410?, 0xc000000000?}, 0xc0003d0a20?) semaphore-1 | /usr/local/go/src/net/http/server.go:2294 +0x29 semaphore-1 | github.com/semaphoreui/semaphore/api.Route.GetMustCanMiddleware.func5.1({0x2957410, 0xc000000000}, 0xc000559680) semaphore-1 | /go/src/semaphore/api/projects/project.go:62 +0x127 semaphore-1 | net/http.HandlerFunc.ServeHTTP(0xc000559400?, {0x2957410?, 0xc000000000?}, 0xf990a0?) semaphore-1 | /usr/local/go/src/net/http/server.go:2294 +0x29 semaphore-1 | github.com/semaphoreui/semaphore/api/projects.ProjectMiddleware.func1({0x2957410, 0xc000000000}, 0xc0001d88c0) semaphore-1 | /go/src/semaphore/api/projects/project.go:46 +0x41f semaphore-1 | net/http.HandlerFunc.ServeHTTP(0x2957410?, {0x2957410?, 0xc000000000?}, 0xe9b580?) semaphore-1 | /usr/local/go/src/net/http/server.go:2294 +0x29 semaphore-1 | github.com/semaphoreui/semaphore/api.authentication.func1({0x2957410, 0xc000000000}, 0x1?) semaphore-1 | /go/src/semaphore/api/auth.go:278 +0x50 semaphore-1 | net/http.HandlerFunc.ServeHTTP(0xf76340?, {0x2957410?, 0xc000000000?}, 0xc?) semaphore-1 | /usr/local/go/src/net/http/server.go:2294 +0x29 semaphore-1 | github.com/semaphoreui/semaphore/api.JSONMiddleware.func1({0x2957410, 0xc000000000}, 0xc000408000) semaphore-1 | /go/src/semaphore/api/router.go:57 +0xf6 semaphore-1 | net/http.HandlerFunc.ServeHTTP(0xe8cd00?, {0x2957410?, 0xc000000000?}, 0x7a9b2c?) semaphore-1 | /usr/local/go/src/net/http/server.go:2294 +0x29 semaphore-1 | github.com/semaphoreui/semaphore/api.StoreMiddleware.func1.1() semaphore-1 | /go/src/semaphore/api/router.go:48 +0x28 semaphore-1 | github.com/semaphoreui/semaphore/db.StoreSession({0x296bd80, 0xc00000ec00}, {0xc0001d6940, 0xc}, 0xc0004e77c8) semaphore-1 | /go/src/semaphore/db/Store.go:696 +0x5f semaphore-1 | github.com/semaphoreui/semaphore/api.StoreMiddleware.func1({0x2957410, 0xc000000000}, 0xc000408000) semaphore-1 | /go/src/semaphore/api/router.go:47 +0x114 semaphore-1 | net/http.HandlerFunc.ServeHTTP(0xc00036de00?, {0x2957410?, 0xc000000000?}, 0xf00160?) semaphore-1 | /usr/local/go/src/net/http/server.go:2294 +0x29 semaphore-1 | github.com/semaphoreui/semaphore/cli/cmd.runService.func1.1({0x2957410, 0xc000000000}, 0xc00057a810?) semaphore-1 | /go/src/semaphore/cli/cmd/root.go:152 +0x11b semaphore-1 | net/http.HandlerFunc.ServeHTTP(0xc0004e7801?, {0x2957410?, 0xc000000000?}, 0x4198e5?) semaphore-1 | /usr/local/go/src/net/http/server.go:2294 +0x29 semaphore-1 | github.com/semaphoreui/semaphore/api.Route.CORSMethodMiddleware.func2.1({0x2957410, 0xc000000000}, 0xc00036cf00) semaphore-1 | /go/src/semaphore/vendor/github.com/gorilla/mux/middleware.go:51 +0x87 semaphore-1 | net/http.HandlerFunc.ServeHTTP(0xc00036cb40?, {0x2957410?, 0xc000000000?}, 0x7f875928e710?) semaphore-1 | /usr/local/go/src/net/http/server.go:2294 +0x29 semaphore-1 | github.com/gorilla/mux.(*Router).ServeHTTP(0xc00020cc00, {0x2957410, 0xc000000000}, 0xc00036c280) semaphore-1 | /go/src/semaphore/vendor/github.com/gorilla/mux/mux.go:212 +0x1e2 semaphore-1 | github.com/semaphoreui/semaphore/cli/cmd.runService.ProxyHeaders.func3({0x2957410, 0xc000000000}, 0xc00036c280) semaphore-1 | /go/src/semaphore/vendor/github.com/gorilla/handlers/proxy_headers.go:59 +0x143 semaphore-1 | net/http.HandlerFunc.ServeHTTP(0xc0001c2004?, {0x2957410?, 0xc000000000?}, 0x1?) semaphore-1 | /usr/local/go/src/net/http/server.go:2294 +0x29 semaphore-1 | github.com/semaphoreui/semaphore/cli/cmd.runService.cropTrailingSlashMiddleware.func5({0x2957410, 0xc000000000}, 0xc00036c280) semaphore-1 | /go/src/semaphore/cli/cmd/server.go:27 +0xbd semaphore-1 | net/http.HandlerFunc.ServeHTTP(0x471b19?, {0x2957410?, 0xc000000000?}, 0xc0004e7b70?) semaphore-1 | /usr/local/go/src/net/http/server.go:2294 +0x2... </details> - Fixes semaphoreui/semaphore#3386 <!-- START COPILOT CODING AGENT TIPS --> --- 💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). 
Copilot AI self-assigned this Nov 2, 2025
Copilot AI and others added 3 commits November 2, 2025 21:10
- Add optional fields to View struct to handle extra columns that may exist in some database schemas - Ensure project tmp directory exists before git commands to prevent chdir errors - Both fixes address the issues reported in versions 2.16.35/36 Co-authored-by: fiftin <914224+fiftin@users.noreply.github.com>
…fails Co-authored-by: fiftin <914224+fiftin@users.noreply.github.com>
… clean Co-authored-by: fiftin <914224+fiftin@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix 400 error on multiple APIs after update Fix 400 errors on views and repository branches endpoints Nov 2, 2025
Copilot AI requested a review from fiftin November 2, 2025 21:14
Copilot finished work on behalf of fiftin November 2, 2025 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants