Sub topic 13
Troubleshooting templates that do not appear
This chapter assumes you have read the earlier chapters on template locations, Markdown issue templates, issue forms, config.yml, and URL prefill. You should be able to read YAML and run basic Git commands. When a template is missing, the cause is almost always one of a few things, and you can check them in a fixed order.
Start with the branch
GitHub reads issue templates from the repository's default branch. A template that exists only on a feature branch will not show in the chooser. Merge it first.
Pull requests work a little differently. GitHub reads the PR template from the base branch, which is the branch you are merging into. In practice, keep all templates on the default branch and you avoid both problems.
Confirm what is actually on the branch, not what is on your laptop:
git fetch origin
git ls-tree -r --name-only origin/main .githubReplace main with your default branch name. If your files are not in the output, they are not merged yet.
Follow the diagnosis order
Check the path and file name
Folder and file names are easy to get slightly wrong.
- Issue templates go in
.github/ISSUE_TEMPLATE/. The folder name is uppercase, and it must be a folder, not a file. - Issue forms must end in
.yml. A form saved as.mdis treated as a Markdown template and shows raw YAML. - A single PR template can be
pull_request_template.mdin the repository root,docs/, or.github/. - Multiple PR templates go in a
PULL_REQUEST_TEMPLATE/folder. A file in that folder does not pre-fill automatically. You select it with?template=.
Validate the content
An invalid issue form is skipped, so the chooser acts as if the file does not exist. Check these first:
- The form has top-level
name,description, andbody. bodycontains at least one element that is nottype: markdown.- Every
idis unique within the form, and each element has theattributesit needs (labelfor inputs,optionsfor dropdowns and checkboxes). - Indentation uses spaces, and strings with
:or[are quoted, such astitle: "[Bug]: ". - A
validationsblock is not attached to amarkdownelement, because that element cannot be required.
Open the file on GitHub. If the form is broken, the file page usually reports the error, and that is quicker than guessing. Pasting the file into a YAML linter also catches indentation mistakes.
For a Markdown template, check that the front matter is wrapped in --- lines and that name and about are present.
Check what overrides what
Several settings change which templates people see:
| Symptom | Likely cause | Fix |
|---|---|---|
| Blank issue option is gone | `blank_issues_enabled: false` in `config.yml` | Set it to `true`, or add a template for general issues |
| Contact link missing | `config.yml` has invalid YAML or a link without `name`, `url`, or `about` | Fix the entry |
| Organization templates ignored | The repository has its own `.github/ISSUE_TEMPLATE/` files | Remove them, or copy the shared ones in |
| Organization templates never appear | The `.github` repository is private, or the files are on a non-default branch | Make it public and merge to its default branch |
| Chooser does not appear at all | Issues are disabled in repository settings | Enable Issues |
A repository's own issue template folder replaces the organization default rather than adding to it. Also remember that forks use their own default branch, so a template added upstream does not appear in a fork until the fork syncs.
Check prefill URLs last
If templates show in the chooser but your link fails, look at the query string:
template=must match the file name exactly, including the extension (bug_report.yml, notbug_report).- For pull requests, use
quick_pull=1together withtemplate=. - Prefilled form fields are matched by the element
id, so a renamedidsilently breaks old links. - Use
+or%20for spaces.
Exercise
You merged .github/ISSUE_TEMPLATE/bug_report.yml into main, but it does not appear in the chooser. The file starts with name, description, and a body that contains only one type: markdown element. What is wrong, and what do you change?
Show answer
A form needs at least one non-markdown element. Add an input, textarea, dropdown, or checkboxes element with a unique id and a label. Then merge the change to the default branch and reload the chooser.