{"record":{"id":"7313f46a64467fec","repo":"amir20/dozzle","slug":"host-s-is-not-served-by-this-dozzle-instance","errorCode":null,"errorMessage":"host %s is not served by this Dozzle instance","messagePattern":"host (.+?) is not served by this Dozzle instance","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"main.go","lineNumber":462,"sourceCode":"\treturn all, errs\n}\n\nfunc (l *cloudHostService) FindContainer(host string, id string, labels container.ContainerLabels) (*container_support.ContainerService, error) {\n\t// No retry: this runs once per log reader, and a run of them against an\n\t// unreachable agent would each wait out the dial timeout.\n\tfor _, s := range l.services(false) {\n\t\tif l.hostID(s) != host {\n\t\t\tcontinue\n\t\t}\n\t\tctx, cancel := l.hostTimeout()\n\t\tcont, err := s.FindContainer(ctx, id, labels)\n\t\tcancel()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn container_support.NewContainerService(s, cont), nil\n\t}\n\treturn nil, fmt.Errorf(\"host %s is not served by this Dozzle instance\", host)\n}\n\n// watchNewServices calls attach again whenever a host that was unreachable at\n// startup joins, so a late agent gets subscribed without waiting for a restart.\n//\n// The ticker is the backstop. SubscribeAvailableHosts only fires on the\n// unreachable-to-reachable edge, so anything attach skipped for another reason\n// — a host whose id could not be resolved at the time — would otherwise stay\n// skipped for the life of the connection. A re-attach that finds nothing new is\n// a map lookup per service, so this is cheap enough to run unconditionally.\n//\n// attach is only ever called from this one goroutine, after the caller's\n// initial synchronous call has returned, so it needs no locking of its own.\nfunc (l *cloudHostService) watchNewServices(ctx context.Context, attach func()) {\n\thosts := make(chan container.Host, 8)\n\tl.hs.SubscribeAvailableHosts(ctx, hosts)\n\tticker := time.NewTicker(reattachInterval)\n\tgo func() {","sourceCodeStart":444,"sourceCodeEnd":480,"githubUrl":"https://github.com/amir20/dozzle/blob/d9463cbe21874e44ab79db6fa63e746ca7d22928/main.go#L444-L480","documentation":"MultiHostService.FindContainer looks up the host ID in the set of configured/known hosts; if the requested host ID is not served by this Dozzle instance, it returns this error. It guards against requests naming hosts from another deployment or stale IDs.","triggerScenarios":"Calling FindContainer (or an HTTP route like /api/hosts/{host}/containers/{id}/...) with a host key that is not in the host map: stale frontend state, wrong agent id, or host was removed/restarted.","commonSituations":"Bookmarked URLs pointing at an old host id; agent containers recreated with new ids; requests proxied to the wrong Dozzle instance; container-store caching a host that disconnected at startup.","solutions":["List current hosts via the hosts API/UI and use the exact host id in the request","Verify remote agents are configured and connected (correct endpoint, shared certs) so the host is registered","Restart/refresh the frontend to clear stale host ids after agents changed","Confirm the request is hitting the Dozzle instance that manages that host"],"exampleFix":"// before\nsvc, err := multiHostService.FindContainer(\"stale-host-id\", containerID, labels)\n// after\nhosts := multiHostService.List()\nif len(hosts) > 0 {\n    svc, err = multiHostService.FindContainer(hosts[0].ID, containerID, labels)\n}","handlingStrategy":"validation","validationCode":"const hosts = await (await fetch('/api/hosts')).json();\nif (!hosts.some(h => h.id === hostId)) throw new Error(`unknown host ${hostId}`);","typeGuard":null,"tryCatchPattern":"try {\n  await fetch(`/api/hosts/${hostId}/containers/${cid}/logs/stream`);\n} catch (e) {\n  if (String(e).includes('is not served by this Dozzle instance')) {\n    await refreshHosts(); // reload host list and retry\n  }\n}","preventionTips":["Re-fetch the host list after agent restarts instead of caching host ids","Confirm the request targets the correct Dozzle instance","Watch the hosts panel for disconnected agents before issuing calls"],"tags":["multi-host","host-not-found","configuration"],"backgroundTag":"resource-not-found","analyzedSha":"d9463cbe21874e44ab79db6fa63e746ca7d22928","analyzedAt":"2026-09-07T10:08:55.855Z","contentChangedAt":"2026-09-07T10:08:55.855Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}