ipfs/kubo · error

expected type %T, got %T

Error message

expected type %T, got %T

What it means

TypeErr guard: a value received in a commands post-processing/encoder path was not of the expected Go type, so it cannot be processed safely. The message names both the expected (%T) and actual (%T) types; the fault is on the producer side (wrong value emitted by a command or plugin), not user input.

Source

Thrown at core/commands/e/error.go:10

package e

import (
	"fmt"
	"runtime/debug"
)

// TypeErr returns an error with a string that explains what error was expected and what was received.
func TypeErr(expected, actual any) error {
	return fmt.Errorf("expected type %T, got %T", expected, actual)
}

// compile time type check that HandlerError is an error
var _ error = New(nil)

// HandlerError adds a stack trace to an error
type HandlerError struct {
	Err   error
	Stack []byte
}

// Error makes HandlerError implement error
func (err HandlerError) Error() string {
	return fmt.Sprintf("%s in:\n%s", err.Err.Error(), err.Stack)
}

// New returns a new HandlerError
func New(err error) HandlerError {

View on GitHub (pinned to 329838acdf)

Solutions

  1. Report the expected/actual type pair with the command to the kubo tracker
  2. Update kubo; encoder mismatches are usually fixed quickly
  3. Retry with a different --enc output format
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at core/commands/e/error.go:10 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ipfs/kubo@329838acdf (2026-09-03). Data as JSON: /api/errors/7fcbd5eba8475276. Report an issue: GitHub.