{"record":{"id":"81a10933f541ec31","repo":"sipeed/picoclaw","slug":"line-channel-secret-and-channel-access-token-are-r","errorCode":null,"errorMessage":"line channel_secret and channel_access_token are required","messagePattern":"line channel_secret and channel_access_token are required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"pkg/channels/line/line.go","lineNumber":61,"sourceCode":"\tconfig         *config.LINESettings\n\tclient         *messaging_api.MessagingApiAPI\n\tbotUserID      string   // Bot's user ID\n\tbotBasicID     string   // Bot's basic ID (e.g. @216ru...)\n\tbotDisplayName string   // Bot's display name for text-based mention detection\n\treplyTokens    sync.Map // chatID -> replyTokenEntry\n\tquoteTokens    sync.Map // chatID -> quoteToken (string)\n\tctx            context.Context\n\tcancel         context.CancelFunc\n}\n\n// NewLINEChannel creates a new LINE channel instance.\nfunc NewLINEChannel(\n\tbc *config.Channel,\n\tcfg *config.LINESettings,\n\tmessageBus *bus.MessageBus,\n) (*LINEChannel, error) {\n\tif cfg.ChannelSecret.String() == \"\" || cfg.ChannelAccessToken.String() == \"\" {\n\t\treturn nil, fmt.Errorf(\"line channel_secret and channel_access_token are required\")\n\t}\n\n\tclient, err := messaging_api.NewMessagingApiAPI(\n\t\tcfg.ChannelAccessToken.String(),\n\t\tmessaging_api.WithHTTPClient(&http.Client{Timeout: 30 * time.Second}),\n\t)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create LINE messaging client: %w\", err)\n\t}\n\n\tbase := channels.NewBaseChannel(\n\t\t\"line\", cfg, messageBus, bc.AllowFrom,\n\t\tchannels.WithMaxMessageLength(5000),\n\t\tchannels.WithGroupTrigger(bc.GroupTrigger),\n\t\tchannels.WithReasoningChannelID(bc.ReasoningChannelID),\n\t)\n\n\treturn &LINEChannel{","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/pkg/channels/line/line.go#L43-L79","documentation":"Constructor validation error from NewLINEChannel: either ChannelSecret or ChannelAccessToken is empty, so the channel cannot be built. Both are required — the secret validates webhook signatures, the token authorizes Messaging API pushes. Fail-fast at construction.","triggerScenarios":"A channel entry of type 'line' is configured with a missing/empty channel_secret or channel_access_token — absent JSON keys, or PICOCLAW_CHANNELS_LINE_CHANNEL_SECRET / PICOCLAW_CHANNELS_LINE_CHANNEL_ACCESS_TOKEN env vars unset.","commonSituations":"Token regenerated in the LINE Developers Console but only one of the two updated in config; secrets loaded from a vault that failed silently leaving empty strings; whitespace-only token after copy-paste (note: .String() is checked for empty only).","solutions":["Set both channel_secret and channel_access_token (json keys) or the two env vars, from the LINE Developers Console > Messaging API credentials.","After regenerating a token in the console, update config immediately — old tokens stop working.","Ensure secret-manager injection actually populates both values (verify non-empty at startup).","Prefer a channel access token (long-lived) over short-lived tokens to avoid frequent rotation failures."],"exampleFix":"# before\n{ \"type\": \"line\", \"settings\": { \"channel_secret\": \"***\" } }\n\n# after\n{ \"type\": \"line\", \"settings\": { \"channel_secret\": \"***\", \"channel_access_token\": \"***\" } }","handlingStrategy":"validation","validationCode":"if cfg.ChannelSecret.String() == \"\" || cfg.ChannelAccessToken.String() == \"\" {\n    return fmt.Errorf(\"line settings incomplete: channel_secret and channel_access_token are required\")\n}","typeGuard":null,"tryCatchPattern":"if _, err := line.NewLINEChannel(bc, cfg, messageBus); err != nil {\n    log.Fatalf(\"channel config invalid: %v\", err) // credentials missing: fix config before deploy\n}","preventionTips":["Fetch both credentials from the LINE Developers Console in one sitting","Verify secret injection actually populates both env vars (PICOCLAW_CHANNELS_LINE_*)","Trim whitespace when loading tokens from vault files","Lint required LINE fields in CI"],"tags":["line","config","go","validation","startup"],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}