{"record":{"id":"96e4dcce774753dd","repo":"hashicorp/nomad","slug":"missing-target-rpc","errorCode":null,"errorMessage":"missing target RPC","messagePattern":"missing target RPC","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/client_agent_endpoint.go","lineNumber":63,"sourceCode":"\n\t// Check ACL for agent write\n\taclObj, err := a.srv.ResolveACL(args)\n\tif err != nil {\n\t\treturn err\n\t} else if !aclObj.AllowAgentWrite() {\n\t\t// we're not checking AllowAgentDebug here because the target might not\n\t\t// be this server, and the server doesn't know if enable_debug has been\n\t\t// set on the target\n\t\treturn structs.ErrPermissionDenied\n\t}\n\n\t// Forward to different region if necessary\n\t// this would typically be done in a.srv.forward() but since\n\t// we are targeting a specific server, not just the leader\n\t// we must manually handle region forwarding here.\n\tregion := args.RequestRegion()\n\tif region == \"\" {\n\t\treturn fmt.Errorf(\"missing target RPC\")\n\t}\n\n\tif region != a.srv.Region() {\n\t\t// Mark that we are forwarding\n\t\targs.SetForwarded()\n\t\treturn a.srv.forwardRegion(region, \"Agent.Profile\", args, reply)\n\t}\n\n\t// Targeting a node, forward request to node\n\tif args.NodeID != \"\" {\n\t\treturn a.forwardProfileClient(args, reply)\n\t}\n\n\t// Handle serverID not equal to ours\n\tif args.ServerID != \"\" {\n\t\tserverToFwd, err := a.forwardFor(args.ServerID, region)\n\t\tif err != nil {\n\t\t\treturn err","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/client_agent_endpoint.go#L45-L81","documentation":"The Agent.Profile RPC targets a specific server rather than the leader, so the endpoint manually performs region forwarding using args.RequestRegion(). If the request does not carry a target region, the endpoint cannot decide where to route the profiling request and returns this error. It is a request-validation failure, not a runtime condition.","triggerScenarios":"Sending an Agent.Profile RPC whose request struct has an empty RequestRegion — e.g. a raw RPC call or custom client that never populated the region field, bypassing the standard Nomad API client that sets it automatically.","commonSituations":"Hand-rolled RPC tooling or Go clients using the low-level api package incorrectly; requests constructed by copying another RPC without SetRegion; proxy implementations stripping the region field.","solutions":["Set the region on the request (via the Nomad API client's SetRegion or by populating RequestRegion) before calling Agent.Profile.","Use the official Nomad HTTP API (`/v1/agent/profiling/...`) instead of raw RPCs so region handling is automatic."],"exampleFix":"// before\nargs := &agent.ProfileRequest{} // region empty\n// after\nargs := &agent.ProfileRequest{}\nargs.SetRegion(\"us-east-1\") // or use QueryOptions.Region via the HTTP API","handlingStrategy":"validation","validationCode":"if args.RequestRegion() == \"\" {\n    return fmt.Errorf(\"Agent.Profile requires a target region\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always configure Region on the Nomad API client for agent RPCs.","Use the official HTTP API instead of raw RPCs.","Never copy request structs between RPC types without re-setting the region."],"tags":["nomad","rpc","agent-profiling","region"],"backgroundTag":"missing-request-parameter","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"}