docker/cli ยท error

secret not found: %s

Error message

secret not found: %s

What it means

Error "secret not found: %s" thrown in docker/cli.

Source

Thrown at cli/command/service/parse.go:50

	}

	res, err := apiClient.SecretList(ctx, client.SecretListOptions{
		Filters: args,
	})
	if err != nil {
		return nil, err
	}

	foundSecrets := make(map[string]string)
	for _, secret := range res.Items {
		foundSecrets[secret.Spec.Annotations.Name] = secret.ID
	}

	addedSecrets := make([]*swarm.SecretReference, 0, len(secretRefs))
	for _, ref := range secretRefs {
		id, ok := foundSecrets[ref.SecretName]
		if !ok {
			return nil, fmt.Errorf("secret not found: %s", ref.SecretName)
		}

		// set the id for the ref to properly assign in swarm
		// since swarm needs the ID instead of the name
		ref.SecretID = id
		addedSecrets = append(addedSecrets, ref)
	}

	return addedSecrets, nil
}

// ParseConfigs retrieves the configs from the requested names and converts
// them to config references to use with the spec
func ParseConfigs(ctx context.Context, apiClient client.ConfigAPIClient, requestedConfigs []*swarm.ConfigReference) ([]*swarm.ConfigReference, error) {
	if len(requestedConfigs) == 0 {
		return []*swarm.ConfigReference{}, nil
	}

View on GitHub (pinned to e9452d6e78)

When it happens

Trigger: Thrown at cli/command/service/parse.go:50 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/4fc4139644736977.json. Report an issue: GitHub.