{"record":{"id":"6db4d83b5e2161f7","repo":"chenhg5/cc-connect","slug":"webex-token-is-required","errorCode":null,"errorMessage":"webex: token is required","messagePattern":"webex: token is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/webex/webex.go","lineNumber":51,"sourceCode":"\tallowFrom []string // lowercased email allowlist; empty = allow all\n\n\tclient webexClient\n\n\tmu               sync.RWMutex\n\thandler          core.MessageHandler\n\tlifecycleHandler core.PlatformLifecycleHandler\n\tcancel           context.CancelFunc\n\tstopping         bool\n\tselfID           string // bot's own personId\n\tselfEmail        string // bot's own email (Mercury actor uses email)\n\tdeviceURL        string // for cleanup on Stop()\n}\n\n// New constructs a Webex platform from config options.\nfunc New(opts map[string]any) (core.Platform, error) {\n\ttoken, _ := opts[\"token\"].(string)\n\tif strings.TrimSpace(token) == \"\" {\n\t\treturn nil, fmt.Errorf(\"webex: token is required\")\n\t}\n\trawAllow, _ := opts[\"allow_from\"].(string)\n\tcore.CheckAllowFrom(\"webex\", rawAllow)\n\n\treturn &Platform{\n\t\ttoken:     token,\n\t\tallowFrom: parseAllowFrom(rawAllow),\n\t\tclient:    newHTTPClient(token),\n\t}, nil\n}\n\nfunc (p *Platform) Name() string { return \"webex\" }\n\n// self returns the bot's own personId under lock.\nfunc (p *Platform) self() string {\n\tp.mu.RLock()\n\tdefer p.mu.RUnlock()\n\treturn p.selfID","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/webex/webex.go#L33-L69","documentation":"New constructs the Webex platform from config options. A missing or whitespace-only 'token' option makes construction fail immediately with this error, since no API call is possible without a bot token.","triggerScenarios":"Calling New (or starting the platform via config) with opts lacking the 'token' key, token set to \"\", or token containing only spaces/tabs.","commonSituations":"config.toml [platform.webex] section missing the token field; environment variable for the token not exported; token placeholder never replaced; YAML/TOML quoting issues producing empty string.","solutions":["Add token = \"<bot-access-token>\" to the webex platform config section","Set the token from the environment if the config templating supports it, and verify it is exported","Trim whitespace / re-copy the token from the Webex developer portal","Check that the config file being loaded is the one you edited"],"exampleFix":"// before\nopts := map[string]any{\"allow_from\": \"\"}\np, _ := webex.New(opts)\n// after\nopts := map[string]any{\"token\": os.Getenv(\"WEBEX_TOKEN\"), \"allow_from\": \"\"}\np, err := webex.New(opts) // err != nil handled","handlingStrategy":"validation","validationCode":"tok, _ := opts[\"token\"].(string)\nif strings.TrimSpace(tok) == \"\" { return errors.New(\"webex token must be set in config\") }","typeGuard":null,"tryCatchPattern":"p, err := webex.New(opts)\nif err != nil { return fmt.Errorf(\"init webex platform: %w\", err) }","preventionTips":["Validate the full config at startup before wiring platforms","Keep tokens in environment variables or secret stores, templated into config","Add a startup self-check that fails fast on empty required fields","Verify the loaded config file is the intended one"],"tags":["webex","config","token","initialization"],"backgroundTag":"missing-required-config-field","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}