nektos/act · error
invalid format '%v', expected a line with '=' or '<<'
Error message
invalid format '%v', expected a line with '=' or '<<'
What it means
Thrown by the .env file parser when a line contains neither '=' (key=value) nor act's heredoc marker '<<'. Every non-comment line in an env file must be KEY=VALUE or KEY<<DELIM; anything else is rejected.
Source
Thrown at pkg/container/parse_env_file.go:63
multiLineEnvDelimiter := line[multiLineEnv+2:]
delimiterFound := false
for s.Scan() {
content := s.Text()
if content == multiLineEnvDelimiter {
delimiterFound = true
break
}
if multiLineEnvContent != "" {
multiLineEnvContent += "\n"
}
multiLineEnvContent += content
}
if !delimiterFound {
return fmt.Errorf("invalid format delimiter '%v' not found before end of file", multiLineEnvDelimiter)
}
localEnv[line[:multiLineEnv]] = multiLineEnvContent
} else {
return fmt.Errorf("invalid format '%v', expected a line with '=' or '<<'", line)
}
}
env = &localEnv
return s.Err()
}
}
View on GitHub (pinned to 4f41128141)
Solutions
- Convert 'export KEY=value' lines to plain 'KEY=value'.
- Remove shell syntax (set, comments without #, blank commands) from the env file.
- Prefix comment lines with # so the parser skips them.
- Run a quick lint: awk -F= 'NF<2 && $0!~/^#/' file to find offending lines.
Example fix
# before (.env) export DEBUG=1 set -e # after (.env) DEBUG=1
Defensive patterns
Strategy: validation
Validate before calling
func lintEnvFile(path string) error {
f, _ := os.Open(path)
defer f.Close()
s := bufio.NewScanner(f)
for s.Scan() {
l := s.Text()
if l == '' || strings.HasPrefix(l, '#') { continue }
if !strings.Contains(l, '=') && !strings.Contains(l, '<<') {
return fmt.Errorf('malformed env line: %q', l)
}
}
return nil
} Prevention
- Never put shell syntax (export, set) in act env files
- Generate env files programmatically rather than reusing shell scripts
- Prefix comments with # only
When it happens
Trigger: Passing --env-file a shell script (with export statements, quotes only, or bare words); stray lines like 'set -e', continuation lines, or prose in the env file.
Common situations: Reusing a shell env script as act env file; files with BOM or Windows artifacts; typo like 'KEY =value' handled elsewhere but a truly malformed line 'KEY value' hits this.
Related errors
- invalid format delimiter '%v' not found before end of file
- --pid: invalid PID mode
- --cgroupns: invalid CGROUP mode
- network-scoped aliases are only supported for user-defined n
- links are only supported for user-defined networks
AI-assisted analysis of nektos/act@4f41128141 (2026-08-15).
Data as JSON: /api/errors/d8abaed65f432880.
Report an issue: GitHub.