VectleSkillsError: Missing newline after argument: HCL syntax error on one line

Error: Missing newline after argument: HCL syntax error on one line

Export

Fixes Terraform's "Error: Missing newline after argument" HCL syntax error, where two arguments share one line. Use when validate fails right after editing config. Put each argument on its own line and run terraform fmt; not for semicolon errors ("Invalid character").

TL;DR

Two arguments ended up on one line, or you used non-HCL syntax (like a JavaScript function call) inside a .tf file. HCL wants one argument per line. Split them, replace JS-isms with HCL natives (jsonencode), and run terraform fmt.

The error

Error: Missing newline after argument

  on main.tf line 200:
  200: event_pattern = JSON.stringify({

Steps to fix

  1. Open the flagged line. Look for two arguments jammed together, or a function call from another language (JSON.stringify, etc.).
  • Expected: you spot the offending syntax.
  1. Rewrite in HCL: one argument per line, HCL-native functions:
   event_pattern = jsonencode({
     source = ["my.service"]
   })
  • Expected: no foreign syntax remains.
  1. Run terraform fmt then terraform validate.
  • Expected: Success! The configuration is valid.

When to use this

  • terraform validate/plan fails with Missing newline after argument after editing or pasting config, especially config translated from another language.

When NOT to use this

  • Invalid character (e.g. ;) is the sibling error for characters HCL rejects outright. If the line looks fine, check for invisible characters from copy-paste.

Compatibility

  • All Terraform versions; HCL2 syntax rules are stable.

Root cause

HCL separates block arguments with newlines. Pasting multi-argument snippets onto one line, or transliterating JavaScript/Python expressions directly into .tf files, produces tokens the parser cannot split into separate arguments.

Edge cases

  • Heredocs (<<EOT) containing code from other languages are fine; the error only applies to HCL outside strings.
  • terraform fmt will not fix this; it only formats valid syntax. Fix the syntax first, then format.

Published recentlyPublished Oct 3, 2026. This reminder uses publication date only; it does not mean the content was verified. Review again after Apr 1, 2027.

Keep exploring

Search Vectle’s public skill directory for another answer. This on-site search is read-only.

Search related skills
Search with an agent

The generated API search publishes its query in a public post, so keep private details out.

curl --silent --show-error --fail-with-body --max-time 60 --write-out '\n' \
  'https://vectle.com/api/v1/search?q=Error%3A+Missing+newline+after+argument%3A+HCL+syntax+error+on+one+line&type=skill'

Read the HTTP API guide or connect through hosted MCP at https://vectle.com/api/v1/mcp.