{"record":{"id":"594d88e3d206bd99","repo":"chenhg5/cc-connect","slug":"init-failed-w","errorCode":null,"errorMessage":"init failed: %w","messagePattern":"init failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cc-connect/feishu.go","lineNumber":546,"sourceCode":"\tif parsed.Msg != \"\" {\n\t\treturn false, fmt.Errorf(\"code=%d msg=%s\", parsed.Code, parsed.Msg)\n\t}\n\treturn false, nil\n}\n\nfunc runRegistrationFlow(opts registrationFlowOptions) (*registrationFlowResult, error) {\n\tif opts.TimeoutSeconds <= 0 {\n\t\topts.TimeoutSeconds = 600\n\t}\n\tclient := &registrationClient{\n\t\tbaseURL: accountsFeishuBaseURL,\n\t\thttp:    &http.Client{Timeout: 15 * time.Second},\n\t\tdebug:   opts.Debug,\n\t}\n\n\tvar initRes registrationInitResponse\n\tif err := client.registrationCall(\"init\", nil, &initRes); err != nil {\n\t\treturn nil, fmt.Errorf(\"init failed: %w\", err)\n\t}\n\tif initRes.Error != \"\" {\n\t\treturn nil, fmt.Errorf(\"%s: %s\", initRes.Error, initRes.ErrorDescription)\n\t}\n\tif len(initRes.SupportedAuthMethods) > 0 && !containsString(initRes.SupportedAuthMethods, \"client_secret\") {\n\t\treturn nil, fmt.Errorf(\"current environment does not support client_secret auth\")\n\t}\n\n\tvar beginRes registrationBeginResponse\n\tbeginParams := map[string]string{\n\t\t\"archetype\":         \"PersonalAgent\",\n\t\t\"auth_method\":       \"client_secret\",\n\t\t\"request_user_info\": \"open_id\",\n\t}\n\tif err := client.registrationCall(\"begin\", beginParams, &beginRes); err != nil {\n\t\treturn nil, fmt.Errorf(\"begin failed: %w\", err)\n\t}\n\tif beginRes.Error != \"\" {","sourceCodeStart":528,"sourceCodeEnd":564,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/cmd/cc-connect/feishu.go#L528-L564","documentation":"runRegistrationFlow starts by calling the registration service's \"init\" endpoint via registrationCall. Any transport/protocol failure there is wrapped as `init failed: %w`, so the underlying cause (network error, timeout, non-2xx, bad payload) is preserved in the chain.","triggerScenarios":"The registration service is unreachable, times out (15s HTTP client timeout), returns a non-2xx status, or registrationCall fails to parse the response during runFeishuSetup.","commonSituations":"No internet or firewalled network during setup; corporate proxy blocking the registration host; transient service outage; DNS failure.","solutions":["Check general internet connectivity and retry the setup command.","Verify proxy/firewall allows the registration host; set HTTPS_PROXY if needed.","Re-run after a short wait if it was a transient outage or timeout.","Unwrap the %w cause in the message for the specific failure (timeout, connection refused, status code)."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"if _, err := http.Head(\"https://your-registration-host\"); err != nil { return fmt.Errorf(\"registration host unreachable before setup: %w\", err) }","typeGuard":null,"tryCatchPattern":"if err := runFeishuSetup(...); err != nil && strings.HasPrefix(err.Error(), \"init failed:\") { var netErr net.Error; if errors.As(err, &netErr) && netErr.Timeout() { log.Print(\"registration init timed out; check network/proxy and retry\") } }","preventionTips":["Verify connectivity and proxy/HTTPS_PROXY settings before running setup.","Allowlist the registration host in firewalled environments.","Retry on transient failures; the client uses a 15s timeout."],"tags":["network","registration","feishu","http"],"backgroundTag":"http-request-failed","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}