Tencent/WeKnora · error

ErrNamedSandboxBackendUnsupported

ErrNamedSandboxBackendUnsupported

Error message

%w

What it means

validateNamedSandboxBackend rejects a tenant sandbox config whose SandboxType is not a recognized named backend type (sandbox.IsNamedSandboxBackendType returns false), surfacing the sentinel ErrNamedSandboxBackendUnsupported wrapped via %w. Called from Create and Update of tenant sandbox configurations.

Source

Thrown at internal/application/service/tenant_sandbox_config.go:402

	}
	return merged, nil
}

func validateSkillRollout(value string) error {
	switch strings.TrimSpace(value) {
	case "", types.SkillRolloutNextTurn, types.SkillRolloutNewSession:
		return nil
	default:
		return apperrors.NewBadRequestError("invalid skill_rollout")
	}
}

func validateNamedSandboxBackend(cfg *types.TenantSandboxConfig) error {
	if cfg == nil || strings.TrimSpace(cfg.SandboxType) == "" {
		return apperrors.NewBadRequestError("sandbox backend type is required")
	}
	if !sandbox.IsNamedSandboxBackendType(cfg.SandboxType) {
		return fmt.Errorf("%w", ErrNamedSandboxBackendUnsupported)
	}
	return sandbox.EnsureDockerBackendAllowed(sandbox.SandboxType(cfg.SandboxType))
}

func filterPublicSandboxConfigs(
	list []*types.TenantSandboxConfigEntity,
) []*types.TenantSandboxConfigEntity {
	if len(list) == 0 {
		return list
	}
	out := make([]*types.TenantSandboxConfigEntity, 0, len(list))
	for _, e := range list {
		if types.IsSandboxWorkspacePolicyRow(e) {
			continue
		}
		out = append(out, e)
	}
	return out

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Use one of the supported named sandbox backend types exactly as defined by sandbox.IsNamedSandboxBackendType (e.g. "docker")
  2. Check config/JSON spelling and casing of the sandbox_type field
  3. Consult the current version's supported backend list — types may change between releases
  4. Ensure validation errors are mapped to a 400 response listing valid values

Example fix

// before
cfg.SandboxType = "Docker" // unsupported casing
// after
cfg.SandboxType = string(sandbox.SandboxTypeDocker)
Defensive patterns

Strategy: validation

Validate before calling

if !sandbox.IsNamedSandboxBackendType(cfg.SandboxType) {
    return errors.New("sandbox_type must be one of the supported named backends")
}

Try / catch

if errors.Is(err, apperrors.ErrNamedSandboxBackendUnsupported) || strings.Contains(err.Error(), "unsupported") {
    // return 400 with list of valid backend types
}

Prevention

When it happens

Trigger: Create or Update of a TenantSandboxConfig with a SandboxType string that is not in the set of named backend types (typo, wrong casing, removed/renamed backend, empty-after-trim handled separately).

Common situations: Typo in sandbox type in tenant config payload (e.g. "docker2", "gVisor"); casing mismatch ("Docker" vs "docker"); backend type removed in a version upgrade; JSON field misspelled so an unexpected value lands in SandboxType.

Related errors


AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02). Data as JSON: /api/errors/8a34946d407b340b. Report an issue: GitHub.