{"record":{"id":"496fc8988b3c8484","repo":"Tencent/WeKnora","slug":"unsupported-timeout-mode-q-496fc8","errorCode":null,"errorMessage":"unsupported timeout mode %q","messagePattern":"unsupported timeout mode %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sandbox/e2b_remote_client.go","lineNumber":1105,"sourceCode":"\t\tif value%time.Second != 0 {\n\t\t\tseconds++\n\t\t}\n\t\treturn int(seconds), nil\n\t}\n\n\tswitch policy.Mode {\n\tcase \"\", RemoteTimeoutServerDefault:\n\t\tif fallback <= 0 {\n\t\t\treturn 0, nil\n\t\t}\n\t\treturn toSeconds(fallback)\n\tcase RemoteTimeoutExplicit:\n\t\tif policy.Value < 0 {\n\t\t\treturn 0, errors.New(\"E2B backend does not support NeverTimeout\")\n\t\t}\n\t\treturn toSeconds(policy.Value)\n\tdefault:\n\t\treturn 0, fmt.Errorf(\"unsupported timeout mode %q\", policy.Mode)\n\t}\n}\n\n// toE2BVolumeMounts converts the provider-neutral RemoteVolumeMount slice to\n// E2B SDK VolumeMount values. Nil and empty inputs both produce nil.\nfunc toE2BVolumeMounts(src []RemoteVolumeMount) []e2b.VolumeMount {\n\tif len(src) == 0 {\n\t\treturn nil\n\t}\n\tresult := make([]e2b.VolumeMount, len(src))\n\tfor i, mount := range src {\n\t\tresult[i] = e2b.VolumeMount{\n\t\t\tName: mount.Name,\n\t\t\tPath: mount.Path,\n\t\t}\n\t}\n\treturn result\n}","sourceCodeStart":1087,"sourceCodeEnd":1123,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/sandbox/e2b_remote_client.go#L1087-L1123","documentation":"e2bTimeoutSeconds converts a provider-neutral timeout policy into E2B seconds. The E2B backend only supports explicit finite timeouts; any other TimeoutMode (e.g. NeverTimeout-style modes besides RemoteTimeoutExplicit) falls into the default branch and is rejected because the SDK's SetTimeout API takes a concrete duration.","triggerScenarios":"Calling Create, Connect, Get, Delete, or CreateSnapshot on the E2B remote client when the configured sandbox timeout policy has a Mode other than RemoteTimeoutExplicit; the message interpolates the offending mode string (e.g. %q shows \"never\").","commonSituations":"Configuring a shared timeout policy intended for local/Docker sandboxes (which support idle/never-timeout semantics) and reusing it for E2B; copying a config where the mode field was defaulted or set from YAML/JSON to a value like 'never' or '' without noticing E2B's restriction; setting policy.Value but forgetting to set Mode to RemoteTimeoutExplicit.","solutions":["Set the timeout policy mode to RemoteTimeoutExplicit with a non-negative Value before constructing/using the E2B client.","If you need an effectively infinite timeout, choose the largest acceptable explicit duration instead of a NeverTimeout-style mode.","If the policy comes from config parsing, normalize unknown/empty modes to RemoteTimeoutExplicit with DefaultE2BSandboxTTL seconds.","Add an early config-validation step that maps or rejects non-explicit timeout modes for E2B-specific deployments."],"exampleFix":"// before\npolicy := RemoteTimeoutPolicy{Mode: RemoteTimeoutNever}\n// after\npolicy := RemoteTimeoutPolicy{Mode: RemoteTimeoutExplicit, Value: 30 * time.Minute}","handlingStrategy":"validation","validationCode":"if policy.Mode != RemoteTimeoutExplicit {\n    return fmt.Errorf(\"E2B requires RemoteTimeoutExplicit, got %q\", policy.Mode)\n}\nif policy.Value < 0 {\n    return errors.New(\"E2B requires non-negative timeout\")\n}","typeGuard":"func isExplicitTimeout(p RemoteTimeoutPolicy) bool {\n    return p.Mode == RemoteTimeoutExplicit && p.Value >= 0\n}","tryCatchPattern":null,"preventionTips":["Default E2B timeout policies to RemoteTimeoutExplicit at config load time","Never reuse local/Docker timeout policies for E2B backends","Add a config lint step that rejects non-explicit modes for remote backends"],"tags":["e2b","timeout","configuration"],"backgroundTag":"unsupported-option-value","analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}