From ecb682ee949fe32e2a72054a727fd591b2ad3e16 Mon Sep 17 00:00:00 2001 From: sjmiller609 <7516283+sjmiller609@users.noreply.github.com> Date: Mon, 11 May 2026 19:00:49 +0000 Subject: [PATCH] Return 404 on restore when instance not found Map instances.ErrNotFound to 404 in RestoreInstance, matching the existing pattern used by ForkInstance and other handlers in this file. Previously this surfaced as a 500. --- cmd/api/api/instances.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/api/api/instances.go b/cmd/api/api/instances.go index 61c38ff8..e3131562 100644 --- a/cmd/api/api/instances.go +++ b/cmd/api/api/instances.go @@ -593,6 +593,11 @@ func (s *ApiService) RestoreInstance(ctx context.Context, request oapi.RestoreIn result, err := s.InstanceManager.RestoreInstance(ctx, inst.Id) if err != nil { switch { + case errors.Is(err, instances.ErrNotFound): + return oapi.RestoreInstance404JSONResponse{ + Code: "not_found", + Message: "instance not found", + }, nil case errors.Is(err, instances.ErrInvalidState): return oapi.RestoreInstance409JSONResponse{ Code: "invalid_state",