{"record":{"id":"d618703a884cc2b2","repo":"mislav/hub","slug":"alias-starting-with-can-t-be-split","errorCode":null,"errorMessage":"alias starting with ! can't be split","messagePattern":"alias starting with ! can't be split","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"commands/runner.go","lineNumber":163,"sourceCode":"\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":145,"sourceCodeEnd":173,"githubUrl":"https://github.com/mislav/hub/blob/5c547ed804368763064e51f3990851e267e88edd/commands/runner.go#L145-L173","documentation":"Aliases whose command string begins with `!` denote shell (external) commands, which splitAliasCmd intentionally refuses to split into gh arguments. Invoking such an alias returns this error so the shell form can be handled elsewhere rather than mis-tokenized.","triggerScenarios":"Invoking a gh alias whose stored value starts with `!` (e.g. `gh alias set say '!echo hi'`) — expandAlias passes \"!echo hi\" to splitAliasCmd, which rejects it via the strings.HasPrefix(cmd, \"!\") check.","commonSituations":"User set up a shell-escape alias expecting gh to run it; config copied from another tool (like git) where `!` aliases are supported; version differences where shell aliases were deprecated in gh.","solutions":["Remove the leading `!` and set a plain gh command alias: `gh alias set <name> 'pr list'`.","If a shell command is needed, define a real shell alias/function or script instead of a gh alias.","Delete the alias if it's obsolete: `gh alias delete <name>`."],"exampleFix":"// before\ngh alias set deploy \"!./deploy.sh\"\n// after: run the script directly in your shell, or\ngh alias set deploy \"workflow run deploy\"","handlingStrategy":"validation","validationCode":"if strings.HasPrefix(aliasBody, \"!\") {\n    return fmt.Errorf(\"alias %q uses shell syntax (!); gh aliases accept only gh commands\", aliasName)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Don't prefix gh alias values with `!`.","Use shell aliases/functions for external commands instead.","Migrate any git-style !aliases when moving to gh."],"tags":["alias","config","shell","cli"],"backgroundTag":"unsupported-alias-shell-syntax","analyzedSha":"5c547ed804368763064e51f3990851e267e88edd","analyzedAt":"2026-09-01T03:34:15.525Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}