{"record":{"id":"a309d7827ffdff76","repo":"chenhg5/cc-connect","slug":"alias-q-not-found","errorCode":null,"errorMessage":"alias %q not found","messagePattern":"alias %q not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/config.go","lineNumber":1785,"sourceCode":"\tdata, err := os.ReadFile(ConfigPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"read config: %w\", err)\n\t}\n\tcfg := &Config{}\n\tif err := toml.Unmarshal(data, cfg); err != nil {\n\t\treturn fmt.Errorf(\"parse config: %w\", err)\n\t}\n\tfound := false\n\tvar remaining []AliasConfig\n\tfor _, a := range cfg.Aliases {\n\t\tif a.Name == name {\n\t\t\tfound = true\n\t\t} else {\n\t\t\tremaining = append(remaining, a)\n\t\t}\n\t}\n\tif !found {\n\t\treturn fmt.Errorf(\"alias %q not found\", name)\n\t}\n\tcfg.Aliases = remaining\n\treturn saveConfig(cfg)\n}\n\n// SaveDisplayConfig persists the display settings to the config file.\n// Uses surgical text editing to preserve comments and unknown fields.\nfunc SaveDisplayConfig(mode *string, thinkingMessages *bool, thinkingMaxLen, toolMaxLen *int, toolMessages *bool) error {\n\tconfigMu.Lock()\n\tdefer configMu.Unlock()\n\tif mode != nil {\n\t\tif err := patchSectionField(\"display\", \"mode\", quoteTomlString(*mode)); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif thinkingMessages != nil {\n\t\tif err := patchSectionField(\"display\", \"thinking_messages\", fmt.Sprintf(\"%t\", *thinkingMessages)); err != nil {\n\t\t\treturn err","sourceCodeStart":1767,"sourceCodeEnd":1803,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/config/config.go#L1767-L1803","documentation":"RemoveAlias returns this after scanning cfg.Aliases and finding no entry whose Name matches the requested name. No file was modified. It is a lookup failure on the persisted alias list, distinct from file/parse errors.","triggerScenarios":"Calling config.RemoveAlias(\"name\") where no alias with that exact Name exists in config.toml — typo, different casing, or the alias was already removed (aliases are matched with ==, so comparison is case-sensitive).","commonSituations":"Typing the alias name wrong; assuming aliases defined per-project or in another config file are global; double-invoking a remove command; stale UI showing an alias deleted by another session.","solutions":["List current aliases (the app's alias list command or read cfg.Aliases) to see exact names.","Match the name exactly, including case and quoting, since comparison is exact string equality.","Ignore/handle the error if the goal is idempotent deletion ('remove if exists').","Check you are editing the same config file (ConfigPath) that contains the alias."],"exampleFix":"// before\nerr := config.RemoveAlias(\"MyAlias\") // stored as \"myalias\" -> not found\n// after\nname := \"myalias\"\naliases, _ := config.ListAliases()\nif slices.ContainsFunc(aliases, func(a config.AliasConfig) bool { return a.Name == name }) {\n    err = config.RemoveAlias(name)\n}","handlingStrategy":"fallback","validationCode":"aliases, err := config.ListAliases()\nexists := slices.ContainsFunc(aliases, func(a config.AliasConfig) bool { return a.Name == name })","typeGuard":"func aliasExists(name string) bool {\n    aliases, err := config.ListAliases()\n    if err != nil { return false }\n    return slices.ContainsFunc(aliases, func(a config.AliasConfig) bool { return a.Name == name })\n}","tryCatchPattern":"if err := config.RemoveAlias(name); err != nil {\n    if strings.Contains(err.Error(), \"not found\") {\n        log.Printf(\"alias %q already absent; treating as no-op\", name)\n        return nil // idempotent delete\n    }\n    return err\n}","preventionTips":["List aliases before removing to copy exact names.","Treat removal as idempotent in scripts.","Remember alias matching is case-sensitive exact equality.","Verify you are operating on the same ConfigPath the alias was created in."],"tags":["config","alias","not-found"],"backgroundTag":"resource-not-found","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"}