microsoft/aspire · error

-32000

-32000

Error message

message

What it means

extractResult converts a JSON-RPC response's "error" object into a Go error whose text is exactly the server-provided message string (code -32000 is the JSON-RPC server-error range; here the code is dropped and only the message is preserved). This is the generic channel for server-side failures raised by the AppHost while executing a capability or callback.

Solutions

  1. Read the error message text — it is the AppHost server's own message and names the failing operation
  2. Fix the capability arguments/API usage indicated by the message (wrong types, missing handles, invalid model operations)
  3. If the message is a callback error, verify the referenced callback was registered and not nil
  4. Upgrade the generated Go client and AppHost together to avoid protocol-shaped server errors

Example fix

// before
result, _ := conn.sendRequest(ctx, "invokeCapability", params) // server error surfaces later

// after
result, err := conn.sendRequest(ctx, "invokeCapability", params)
if err != nil {
	log.Printf("apphost capability failed: %v", err) // message from server error object
	return err
}
Defensive patterns

Strategy: try-catch

Try / catch

result, err := capability(ctx, args)
if err != nil {
	// err text is the AppHost server's message; log and inspect args/usage
	log.Printf("apphost error: %v", err)
	return err
}

Prevention

When it happens

Trigger: Any request (invokeCapability, authenticate, cancelToken, ping) whose response map contains an "error" member — server-side capability exceptions, CapabilityError conditions surfaced before tryGetAtsError runs, callback dispatch failures (e.g. "callback ID missing" or "callback not found: ..." from error 2093's path, enqueued with code -32000).

Common situations: Server-side validation failures in a capability; invoking a capability with wrong argument shapes; AppHost raising exceptions during model building; callback invocation errors reported back through the JSON-RPC error field.

Related errors


AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16). Data as JSON: /api/errors/4e4fcc1c133197a5. Report an issue: GitHub.

Appendix: source

Thrown at src/Aspire.Hosting.CodeGeneration.Go/Resources/transport.go:770

}

func (c *client) onConnectionClose(_ error) {
	c.mu.Lock()
	c.conn = nil
	callbacks := c.disconnectCallbacks
	c.disconnectCallbacks = nil
	c.mu.Unlock()
	for _, cb := range callbacks {
		cb()
	}
}

// ── Package-level I/O helpers ─────────────────────────────────────────────────

func extractResult(response map[string]any) (any, error) {
	if errObj, hasErr := response["error"]; hasErr {
		errMap, _ := errObj.(map[string]any)
		return nil, errors.New(getString(errMap, "message"))
	}
	return response["result"], nil
}

func writeMessage(w io.Writer, msg map[string]any) error {
	body, err := json.Marshal(msg)
	if err != nil {
		return err
	}
	header := fmt.Sprintf("Content-Length: %d\r\n\r\n", len(body))
	if _, err = w.Write([]byte(header)); err != nil {
		return err
	}
	_, err = w.Write(body)
	return err
}

func readMessage(reader *bufio.Reader) (map[string]any, error) {

View on GitHub (pinned to 25830f84bd)