{"record":{"id":"0a46993a45ad9469","repo":"Tencent/WeKnora","slug":"unsupported-remote-sandbox-provider-q","errorCode":null,"errorMessage":"unsupported remote sandbox provider %q","messagePattern":"unsupported remote sandbox provider %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sandbox/session_lifecycle.go","lineNumber":67,"sourceCode":"func newRemoteSessionLifecycle(\n\tclient RemoteSandboxClient,\n\tbindings SessionSandboxBindingStore,\n\tsessionChecker SessionExistenceChecker,\n\tcreateRequest RemoteCreateRequest,\n\tcleanupTimeout time.Duration,\n\tsandboxConfigID string,\n) (*remoteSessionLifecycle, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"remote sandbox client is required\")\n\t}\n\tif bindings == nil {\n\t\treturn nil, errors.New(\"session sandbox binding store is required\")\n\t}\n\tif sessionChecker == nil {\n\t\treturn nil, errors.New(\"session existence checker is required\")\n\t}\n\tif !isRemoteProvider(client.Provider()) {\n\t\treturn nil, fmt.Errorf(\"unsupported remote sandbox provider %q\", client.Provider())\n\t}\n\tif !client.Capabilities().SupportsReconnect {\n\t\treturn nil, fmt.Errorf(\"remote sandbox provider %q does not support reconnect\", client.Provider())\n\t}\n\tif strings.TrimSpace(createRequest.TemplateID) == \"\" {\n\t\treturn nil, errors.New(\"remote sandbox template ID is required\")\n\t}\n\tif cleanupTimeout <= 0 {\n\t\treturn nil, errors.New(\"remote sandbox cleanup timeout must be positive\")\n\t}\n\tif strings.TrimSpace(sandboxConfigID) == \"\" {\n\t\tsandboxConfigID = types.SandboxConfigIDGlobalDefault\n\t}\n\tcreateRequest.Metadata = cloneMetadata(createRequest.Metadata)\n\tcreateRequest.EnvVars = cloneMetadata(createRequest.EnvVars)\n\treturn &remoteSessionLifecycle{\n\t\tclient:          client,\n\t\tbindings:        bindings,","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/sandbox/session_lifecycle.go#L49-L85","documentation":"newRemoteSessionLifecycle validates that the supplied RemoteSandboxClient's Provider is one of the supported remote sandbox providers. If the provider name is not recognized by isRemoteProvider, construction fails with this error before any lifecycle object is created. The library throws it to prevent running the session-bound sandbox lifecycle against a client type it cannot coordinate (e.g. a local or unknown provider).","triggerScenarios":"newRemoteSessionLifecycle (via newE2BIntegrationLifecycle, NewSessionBoundManager, test fixtures) receives a client whose Provider() string is not in the supported remote provider set — typically a local sandbox client or a custom/misconfigured provider name.","commonSituations":"Config points the session-bound manager at a local sandbox implementation; a provider enum/string was renamed or typo'd (e.g. \"e2b \" vs \"e2b\"); custom RemoteSandboxClient plugged in without registering its provider; test fixture built with the wrong fake provider.","solutions":["Print/inspect client.Provider() and compare against the values accepted by isRemoteProvider in the sandbox package.","Configure the intended remote provider (e.g. e2b) so the correct RemoteSandboxClient implementation is constructed.","If integrating a new provider, extend isRemoteProvider (and its capabilities) to include it rather than passing an unregistered client.","Fix typos or casing in the provider string in config/env."],"exampleFix":"// before\nclient := sandbox.NewLocalSandboxClient(...) // Provider() == \"local\"\nlc, err := sandbox.NewSessionBoundManager(client, store, checker, req, timeout)\n// after\nclient, err := sandbox.NewE2BClient(apiKey) // Provider() == \"e2b\", a supported remote provider\nlc, err := sandbox.NewSessionBoundManager(client, store, checker, req, timeout)","handlingStrategy":"validation","validationCode":"switch client.Provider() {\ncase \"e2b\":\n    // supported\ndefault:\n    return fmt.Errorf(\"provider %q is not a supported remote sandbox provider\", client.Provider())\n}","typeGuard":"func isSupportedRemoteProvider(p string) bool {\n    switch p {\n    case \"e2b\":\n        return true\n    default:\n        return false\n    }\n}","tryCatchPattern":"mgr, err := sandbox.NewSessionBoundManager(client, store, checker, req, timeout)\nif err != nil {\n    if strings.Contains(err.Error(), \"unsupported remote sandbox provider\") {\n        return fmt.Errorf(\"config error: %w\", err)\n    }\n    return err\n}","preventionTips":["Validate the sandbox provider value in config at startup, before wiring the manager.","Only pass remote provider clients to NewSessionBoundManager; keep local clients on separate paths.","Keep provider name constants in one shared package to avoid typos.","Add a startup smoke test that constructs the lifecycle with production config."],"tags":["configuration","sandbox","provider-validation"],"backgroundTag":"unsupported-provider","analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}