> ## Documentation Index
> Fetch the complete documentation index at: https://tally.wharflab.com/llms.txt
> Use this file to discover all available pages before exploring further.

# shellcheck/SC1040

> When using `<<-`, the heredoc terminator may only be indented with tabs.

When using `<<-`, the heredoc terminator may only be indented with tabs.

| Property | Value |
| - | - |
| Severity | Error |
| Category | Best Practices |
| Default | Enabled (via `shellcheck/*`) |
| Auto-fix | Yes (`--fix`, safe) |

## Description

The `<<-` heredoc form strips leading **tabs** from heredoc lines. Leading spaces before the terminator are invalid and can prevent correct heredoc
termination.

tally reports this as `shellcheck/SC1040` and provides an auto-fix that removes only the extra leading spaces from the terminator indentation.

## Examples

### Problematic code

```dockerfile theme={null}
RUN <<'SCRIPT'
cat <<-EOF
hello
  EOF
EOF
SCRIPT
```

### Correct code

```dockerfile theme={null}
RUN <<'SCRIPT'
cat <<-EOF
hello
	EOF
EOF
SCRIPT
```

## Auto-fix

The fix is minimal:

* removes only leading space runs in the offending terminator line
* preserves tab indentation
* emits narrow edits so other fixes can still apply to the same script

```bash theme={null}
tally lint --fix --select shellcheck/SC1040 Dockerfile
```

## Reference

* [ShellCheck SC1040](https://www.shellcheck.net/wiki/SC1040)


## Related topics

- [Hadolint rules](https://tally.wharflab.com/rules/hadolint/overview.md)
- [Rules overview](https://tally.wharflab.com/rules/overview.md)
- [tally/sort-packages](https://tally.wharflab.com/rules/tally/sort-packages.md)
- [Introduction](https://tally.wharflab.com/introduction.md)
- [Quick start](https://tally.wharflab.com/quickstart.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.