Skip to content

Problem: Project restore via API causes nil pointer dereference (v2.16.51, BoltDB) #3580

@paulvanleest

Description

@paulvanleest

Describe the bug

When restoring a project via the /api/projects/restore endpoint, Semaphore panics with a nil pointer dereference. This happens both via API call and via the UI "Restore Project" feature.

Semaphore version

  • Version: 2.16.51
  • Database: BoltDB
  • OS: Debian (LXC container)

Steps to reproduce

  1. Export a project backup from Semaphore UI
  2. Try to restore via API:
    curl -X POST "http://localhost:3000/api/projects/restore" \
      -H "Content-Type: application/json" \
      -H "Cookie: <session_cookie>" \
      -d @backup.json
    

Or try via UI: Project dropdown → Restore Project → upload JSON

Expected behavior

Project should be restored from backup.

Actual behavior

Server crashes with panic. Returns 502 (via UI) or connection closed (via API). The project does appear to get restored though.

Stack trace

2026/01/24 20:52:12 http: panic serving 127.0.0.1:58738: runtime error: invalid memory address or nil pointer dereference goroutine 16 [running]: net/http.(*conn).serve.func1() /opt/hostedtoolcache/go/1.25.5/x64/src/net/http/server.go:1943 +0xd3 panic({0xede200?, 0x3068950?}) /opt/hostedtoolcache/go/1.25.5/x64/src/runtime/panic.go:783 +0x132 github.com/semaphoreui/semaphore/db/bolt.createObjectType({0x0, 0x0}) /home/runner/work/semaphore/semaphore/db/bolt/BoltDb.go:301 +0x2d github.com/semaphoreui/semaphore/db/bolt.unmarshalObject({0xc000188160, 0x48, 0x48}, {0x0, 0x0}, {0x0, 0x0, 0xfe0315?}) /home/runner/work/semaphore/semaphore/db/bolt/BoltDb.go:326 +0x8b github.com/semaphoreui/semaphore/db/bolt.(*BoltDb).getObjectTx(...)

Notes

Similar to #2678 which was fixed in v2.11.4, but this appears to be a regression or different root cause
Related issues: #2419, #3172, #3177

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions