docker/cli ยท error

failed to remove context %s: %w

Error message

failed to remove context %s: %w

What it means

Error "failed to remove context %s: %w" thrown in docker/cli.

Source

Thrown at cli/context/store/store.go:144

	if err != nil {
		return nil, err
	}
	names := make([]string, 0, len(list))
	for _, item := range list {
		names = append(names, item.Name)
	}
	return names, nil
}

// CreateOrUpdate creates or updates metadata for the context.
func (s *ContextStore) CreateOrUpdate(meta Metadata) error {
	return s.meta.createOrUpdate(meta)
}

// Remove deletes the context with the given name, if found.
func (s *ContextStore) Remove(name string) error {
	if err := s.meta.remove(name); err != nil {
		return fmt.Errorf("failed to remove context %s: %w", name, err)
	}
	if err := s.tls.remove(name); err != nil {
		return fmt.Errorf("failed to remove context %s: %w", name, err)
	}
	return nil
}

// GetMetadata returns the metadata for the context with the given name.
// It returns an errdefs.ErrNotFound if the context was not found.
func (s *ContextStore) GetMetadata(name string) (Metadata, error) {
	return s.meta.get(name)
}

// ResetTLSMaterial removes TLS data for all endpoints in the context and replaces
// it with the new data.
func (s *ContextStore) ResetTLSMaterial(name string, data *ContextTLSData) error {
	if err := s.tls.remove(name); err != nil {
		return err

View on GitHub (pinned to e9452d6e78)

When it happens

Trigger: Thrown at cli/context/store/store.go:144 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of docker/cli@e9452d6e78 (2026-08-01). Data as JSON: /data/errors/1319067557f70011.json. Report an issue: GitHub.