{"record":{"id":"5401f671edda0795","repo":"hashicorp/nomad","slug":"no-service-registrations-with-prefix-q-found","errorCode":null,"errorMessage":"No service registrations with prefix %q found","messagePattern":"No service registrations with prefix %q found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command/service_info.go","lineNumber":298,"sourceCode":"\t\t// ensuring the service name if the final argument on the command.\n\t\tif i == numArgs-1 {\n\t\t\tserviceName := newArgs[i]\n\t\t\tnewArgs[i] = \"-page-token=\" + nextToken\n\t\t\tnewArgs = append(newArgs, serviceName)\n\t\t}\n\t}\n\treturn strings.Join(newArgs, \" \")\n}\n\nfunc getServiceByPrefix(client *api.Services, opts *api.QueryOptions) (ns, id string, possible []*api.ServiceRegistrationListStub, err error) {\n\tpossible, _, err = client.List(opts)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tswitch len(possible) {\n\tcase 0:\n\t\terr = fmt.Errorf(\"No service registrations with prefix %q found\", opts.Prefix)\n\t\treturn\n\tcase 1: // single namespace\n\t\tns = possible[0].Namespace\n\t\tservices := possible[0].Services\n\t\tswitch len(services) {\n\t\tcase 0:\n\t\t\t// should never happen because we should never get an empty stub\n\t\t\terr = fmt.Errorf(\"No service registrations with prefix %q found\", opts.Prefix)\n\t\t\treturn\n\t\tcase 1:\n\t\t\tid = services[0].ServiceName\n\t\t\tpossible = nil\n\t\t\treturn\n\t\tdefault:\n\t\t\tfor _, service := range services {\n\t\t\t\tif service.ServiceName == opts.Prefix { // exact match\n\t\t\t\t\tid = service.ServiceName\n\t\t\t\t\tpossible = nil","sourceCodeStart":280,"sourceCodeEnd":316,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/command/service_info.go#L280-L316","documentation":"getServiceByPrefix resolves a user-supplied service name prefix across namespaces using Nomad's service registration list API. If no service registrations match the prefix in any namespace, the `nomad service info` command errors with `No service registrations with prefix %q found`. It indicates the service registry has no entries matching the query, not a transport failure.","triggerScenarios":"Running `nomad service info <prefix>` where the prefix matches no registered services — the service was never registered, its job was stopped (deregistering services), wrong namespace, or a typo in the prefix.","commonSituations":"Querying before the job deploying the service has run; services deregistered after job stop; ACL token scoped to a namespace without the registrations; confusing Consul service names with Nomad-native service registrations; case-sensitivity mismatches.","solutions":["Run `nomad service list` (or list in all namespaces with -namespace '*') to see registered services and pick the exact name.","Check the job that registers the service is running and uses a `service` block with the expected name/provider.","Verify -namespace and ACL token capabilities for service registration read.","Confirm you are querying Nomad service registry, not Consul, or use the right provider flag."],"exampleFix":"// before\nnomad service info web-frontend\n// after\nnomad service list\nnomad service info -namespace default web","handlingStrategy":"validation","validationCode":"// Check the service exists before fetching details\nservices, _, err := client.Services().List(nil)\nif err != nil {\n    return err\n}\nfound := false\nfor _, ns := range services {\n    for _, s := range ns.Services {\n        if strings.HasPrefix(s.ServiceName, opts.Prefix) {\n            found = true\n        }\n    }\n}\nif !found {\n    return fmt.Errorf(\"no service registrations match %q; run 'nomad service list'\", opts.Prefix)\n}","typeGuard":null,"tryCatchPattern":"// Distinguish not-found from transient errors when resolving the prefix\n_, _, err := getServiceByPrefix(client, opts)\nif err != nil {\n    if strings.Contains(err.Error(), \"No service registrations\") {\n        return fmt.Errorf(\"service %q not registered; check 'nomad service list' and the owning job\", opts.Prefix)\n    }\n    return err // transport/ACL error\n}","preventionTips":["Run `nomad service list` (optionally -namespace '*') and copy exact service names","Ensure the deploying job's service block name/provider matches what you query","Verify ACL token has service registration read in the target namespace","Remember Nomad-native services differ from Consul-registered services"],"tags":["nomad","cli","service-discovery","prefix-lookup"],"backgroundTag":"resource-not-found","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}