OpenNHP/opennhp · error
TrustedApplication not found, please register first
Error message
TrustedApplication not found, please register first
What it means
GetTrustedApplication looks up a TrustedApplication by UUID in the in-memory bufferedTaMap (protected by bufferedTaLock). If the TA was never registered (or the buffer was cleared/restarted), it returns this error instead of a nil struct, telling the caller to register the TA before calling its functions.
Solutions
- Call the TA registration API for that UUID before invoking functions on it.
- Verify the UUID matches the one returned at registration time (no stale/hardcoded UUID).
- Re-register after any agent restart, since bufferedTaMap is in-memory only.
- Persist the UUID in config if you must reuse it across restarts, and re-register at startup.
Example fix
// before
ta, _ := GetTrustedApplication(uuid)
ta.CallFunction(...)
// after
ta, err := GetTrustedApplication(uuid)
if err != nil {
ta, err = RegisterTrustedApplication(uuid, ...)
if err != nil { return err }
}
result, err := CallTrustedApplication(ta, fn, args) Defensive patterns
Strategy: type-guard
Validate before calling
ta, err := GetTrustedApplication(uuid)
if err != nil {
ta, err = RegisterTrustedApplication(uuid, ...)
if err != nil { return err }
} Type guard
func taRegistered(uuid string) bool {
bufferedTaLock.Lock()
defer bufferedTaLock.Unlock()
_, ok := bufferedTaMap[uuid]
return ok
} Try / catch
ta, err := GetTrustedApplication(uuid)
if err != nil {
return fmt.Errorf("ta %s: %w (register first)", uuid, err)
} Prevention
- Always register the TA immediately after agent startup, before any function calls.
- Never persist and reuse UUIDs across restarts without re-registering.
- Store the registration UUID in one place and use it consistently.
When it happens
Trigger: CallTrustedApplication invoking GetTrustedApplication with a trustedAppUuid absent from bufferedTaMap — typically before RegisterTrustedApplication has completed or after a process restart wiped the buffer.
Common situations: Calling TA functions without running the register step first; using a stale UUID from a previous agent session; TA registration failed silently earlier; calling from a different process than the one that registered.
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
Related errors
- unexpected content type: %T
- missing connection data for server
- unknown remote provider
- unknown remote provider
- unsupported key type, expect RSA
AI-assisted analysis of OpenNHP/opennhp@6e04ca5ff0 (2026-09-07).
Data as JSON: /api/errors/6005907183ca2d1d.
Report an issue: GitHub.
Appendix: source
Thrown at endpoints/agent/ta.go:139
ta.Ctx = ctx
ta.Cancel = cancel
ta.Client = c
if _, exists := bufferedTaMap[tadId]; !exists {
bufferedTaMap[tadId] = ta
}
return ta, nil
}
func GetTrustedApplication(trustedAppUuid string) (*TrustedApplication, error) {
bufferedTaLock.Lock()
defer bufferedTaLock.Unlock()
if ta, exists := bufferedTaMap[trustedAppUuid]; exists {
return ta, nil
} else {
return nil, fmt.Errorf("TrustedApplication not found, please register first")
}
}
func (ta *TrustedApplication) GetSupportedFunctions() []TAFunction {
return ta.Functions
}
func (ta *TrustedApplication) CallFunction(function string, params map[string]any) (string, error) {
callRequest := mcp.CallToolRequest{
Params: mcp.CallToolParams{
Name: function,
Arguments: params,
},
}
callResponse, err := ta.Client.CallTool(ta.Ctx, callRequest)
if err != nil {
return "", errView on GitHub (pinned to 6e04ca5ff0)