{"record":{"id":"283e259bd11c047f","repo":"gravitational/teleport","slug":"baseurl-is-not-defined","errorCode":null,"errorMessage":"baseURL is not defined","messagePattern":"baseURL is not defined","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"info","filePath":"lib/autoupdate/tools/utils.go","lineNumber":50,"sourceCode":"\t\"strings\"\n\t\"time\"\n\n\t\"github.com/coreos/go-semver/semver\"\n\t\"github.com/gravitational/trace\"\n\n\t\"github.com/gravitational/teleport/api/constants\"\n\t\"github.com/gravitational/teleport/api/types\"\n\t\"github.com/gravitational/teleport/lib/automaticupgrades/version\"\n\t\"github.com/gravitational/teleport/lib/autoupdate\"\n\t\"github.com/gravitational/teleport/lib/modules\"\n\t\"github.com/gravitational/teleport/lib/utils\"\n\t\"github.com/gravitational/teleport/lib/utils/packaging\"\n)\n\nvar (\n\t// ErrNoBaseURL is returned when `TELEPORT_CDN_BASE_URL` must be set\n\t// in order to proceed with managed updates.\n\tErrNoBaseURL = errors.New(\"baseURL is not defined\")\n\t// ErrVersionCheck is returned when the downloaded version fails\n\t// to execute for version identification.\n\tErrVersionCheck = errors.New(\"version check failed\")\n)\n\n// Dir returns the client tools installation directory path, using the following fallback order:\n// $TELEPORT_TOOLS_DIR, $TELEPORT_HOME/bin, and $HOME/.tsh/bin.\nfunc Dir() (string, error) {\n\ttoolsDir := os.Getenv(teleportToolsDirsEnv)\n\tif toolsDir == \"\" {\n\t\ttoolsDir = os.Getenv(types.HomeEnvVar)\n\t\tif toolsDir == \"\" {\n\t\t\tvar err error\n\t\t\ttoolsDir, err = os.UserHomeDir()\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", trace.Wrap(err)\n\t\t\t}\n\t\t\ttoolsDir = filepath.Join(toolsDir, \".tsh\", \"bin\")","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/gravitational/teleport/blob/1283425b60ec5f60d509ba4c791183d452923ff7/lib/autoupdate/tools/utils.go#L32-L68","documentation":"ErrNoBaseURL indicates that managed (self-)updates of client tools cannot proceed because TELEPORT_CDN_BASE_URL is not set. When updates are centrally managed, the CDN base URL must be provided via that environment variable; without it the updater cannot construct download URLs. Callers intentionally ignore this error to fall back to executing the current tools version.","triggerScenarios":"updateAndReExec / DownloadUpdate / teleportPackageURLs invoked during a tools update check while TELEPORT_CDN_BASE_URL is unset; helper.go:219 and helper.go:234 treat it as a non-fatal skip of the update path.","commonSituations":"Enterprise/managed deployments where the CDN base URL env var was not propagated to the shell, systemd unit, or CI job; users upgrading from unmanaged (public CDN) builds where the variable is unnecessary.","solutions":["Set TELEPORT_CDN_BASE_URL to your managed CDN base URL in the environment (shell profile, systemd unit, or CI config).","If managed updates are not intended, ignore the error (as helper.go does) and continue with the current binary.","Verify with `printenv TELEPORT_CDN_BASE_URL` that the variable reaches the process running the update check.","Confirm the update policy/feature flags match your deployment (managed vs public CDN)."],"exampleFix":"// before\nerr := updater.Update(ctxUpdate, resp.Version) // fails: baseURL is not defined\n// after\nexport TELEPORT_CDN_BASE_URL=https://cdn.example.com/teleport\n// or, in the caller:\nif err := updater.Update(ctxUpdate, resp.Version); err != nil && !errors.Is(err, ErrNoBaseURL) {\n    return trace.Wrap(err)\n}","handlingStrategy":"validation","validationCode":"if os.Getenv(\"TELEPORT_CDN_BASE_URL\") == \"\" {\n    // managed updates disabled; skip update path or set the variable\n}","typeGuard":"func IsNoBaseURL(err error) bool { return errors.Is(err, tools.ErrNoBaseURL) }","tryCatchPattern":"err := updater.Update(ctxUpdate, v)\nif err != nil && !errors.Is(err, context.Canceled) && !errors.Is(err, ErrNoBaseURL) {\n    return trace.Wrap(err)\n}\n// ErrNoBaseURL: continue executing the current tools version","preventionTips":["Set TELEPORT_CDN_BASE_URL wherever managed updates are used (systemd unit, shell, CI)","Only require the variable when the deployment actually uses a managed CDN","Treat this error as a soft skip in update-check paths"],"tags":["environment-variable","autoupdate","managed-updates","sentinel-error"],"backgroundTag":"missing-env-var","analyzedSha":"1283425b60ec5f60d509ba4c791183d452923ff7","analyzedAt":"2026-09-02T04:06:41.601Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}