slimtoolkit/slim · error

unknown service - %s

Error message

unknown service - %s

What it means

Execution.PrepareService looks up the requested service name in ref.AllServices (the resolved service map for the compose project). If the name is not present, it returns 'unknown service - %s'. This means the service is not part of the execution's resolved/selected service set.

Source

Thrown at pkg/app/master/compose/execution.go:612

		}(name)
	}

	wg.Wait()
	select {
	case err := <-errCh:
		return err
	default:
		return nil
	}

	return nil
}

func (ref *Execution) PrepareService(ctx context.Context, name string) error {
	ref.logger.Debugf("Execution.PrepareService(%s)", name)
	serviceInfo, ok := ref.AllServices[name]
	if !ok {
		return fmt.Errorf("unknown service - %s", name)
	}

	service := serviceInfo.Config
	ref.logger.Debugf("Execution.PrepareService(%s): image=%s", name, service.Image)

	if service.Image == "" {
		imageName := fmt.Sprintf("%s_%s", ref.Project.Name, name)
		if ref.BuildImages && service.Build != nil {
			if err := buildImage(ctx, ref.apiClient, ref.BaseComposeDir, imageName, service.Build); err != nil {
				return err
			}
		} else {
			return fmt.Errorf("cant build service image - %s", name)
		}
	} else {
		found, err := HasImage(ref.apiClient, service.Image)
		if err != nil {
			return err

View on GitHub (pinned to 81940d17fa)

Solutions

  1. Print the available services (e.g. iterate ref.AllServices keys or run the compose config/ps equivalent) and correct the service name
  2. Recreate the Execution after editing the compose file so AllServices reflects the current definitions
  3. Fix the typo / wrong project: ensure the name matches a service defined in the loaded compose configuration

Example fix

// before
err := execution.PrepareService(ctx, "web-app")   // service is named "webapp"
// after
err := execution.PrepareService(ctx, "webapp")
Defensive patterns

Strategy: validation

Validate before calling

func serviceExists(exec *compose.Execution, name string) bool {
    _, ok := exec.AllServices[name]
    return ok
}

if !serviceExists(execution, "web") {
    return fmt.Errorf("service %q not in project; available: %v", "web", keys(execution.AllServices))
}

Try / catch

if err := execution.PrepareService(ctx, svc); err != nil {
    if strings.HasPrefix(err.Error(), "unknown service - ") {
        return fmt.Errorf("service %q not found in compose project: %w", svc, err)
    }
    return err
}

Prevention

When it happens

Trigger: Calling PrepareService(ctx, name) with a service name that is not a key in Execution.AllServices — typically a name not defined in the compose file, a typo, or a service added after the Execution was created.

Common situations: Typos in service names, referencing services from an override file that wasn't loaded, running PrepareService for a service belonging to a different compose project, or scripts using stale names after a compose file refactor.

Related errors


AI-assisted analysis of slimtoolkit/slim@81940d17fa (2026-08-31). Data as JSON: /api/errors/f517efa1140109cb. Report an issue: GitHub.