{"record":{"id":"3c6a883f2ad7b506","repo":"mislav/hub","slug":"alias-can-t-be-empty","errorCode":null,"errorMessage":"alias can't be empty","messagePattern":"alias can't be empty","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"commands/runner.go","lineNumber":159,"sourceCode":"\t\tif e == nil {\n\t\t\targs.Command = words[0]\n\t\t\targs.PrependParams(words[1:]...)\n\t\t}\n\t}\n}\n\nfunc isBuiltInHubCommand(command string) bool {\n\tfor hubCommand := range CmdRunner.All() {\n\t\tif hubCommand == command {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n\nfunc splitAliasCmd(cmd string) ([]string, error) {\n\tif cmd == \"\" {\n\t\treturn nil, fmt.Errorf(\"alias can't be empty\")\n\t}\n\n\tif strings.HasPrefix(cmd, \"!\") {\n\t\treturn nil, fmt.Errorf(\"alias starting with ! can't be split\")\n\t}\n\n\twords, err := shellquote.Split(cmd)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn words, nil\n}\n","sourceCodeStart":141,"sourceCodeEnd":173,"githubUrl":"https://github.com/mislav/hub/blob/5c547ed804368763064e51f3990851e267e88edd/commands/runner.go#L141-L173","documentation":"splitAliasCmd splits an alias's command string into words for execution. An empty alias body cannot be split or executed, so the function immediately returns this error, which propagates when gh expands the alias during command dispatch.","triggerScenarios":"A configured alias (in gh config or `gh alias set`) has an empty value, e.g. `gh alias set myalias \"\"`, and the user then invokes that alias, causing expandAlias -> splitAliasCmd(\"\").","commonSituations":"Alias created from a shell variable that expanded to nothing; alias value accidentally deleted from the config file; migration/backup of the config lost the alias body.","solutions":["Delete the broken alias: `gh alias delete <name>`.","Re-set it with a real command: `gh alias set <name> 'pr list'`.","Inspect the config file (aliases section) and remove or fix empty entries."],"exampleFix":"// before\ngh alias set co \"\"\n// after\ngh alias set co \"pr checkout\"","handlingStrategy":"validation","validationCode":"if aliasBody == \"\" {\n    return fmt.Errorf(\"alias %q is empty; re-set it with: gh alias set <name> <command>\", aliasName)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never call `gh alias set <name> \"\"` with an empty value.","Quote shell variables so a blank var doesn't produce an empty alias.","Audit the aliases config section for empty entries."],"tags":["alias","config","validation","cli"],"backgroundTag":"empty-alias-value","analyzedSha":"5c547ed804368763064e51f3990851e267e88edd","analyzedAt":"2026-09-01T03:34:15.525Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}