{"record":{"id":"8ca7f0831c53039c","repo":"nektos/act","slug":"closing-bracket-without-opening-one-the-following","errorCode":null,"errorMessage":"Closing bracket without opening one. The following format string is invalid: '%s'","messagePattern":"Closing bracket without opening one\\. The following format string is invalid: '(.+?)'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/exprparser/functions.go","lineNumber":133,"sourceCode":"\t\t\tswitch character {\n\t\t\tcase '}':\n\t\t\t\toutput += \"}\"\n\t\t\t\treplacementIndex = \"\"\n\t\t\t\tstate = passThrough\n\n\t\t\tdefault:\n\t\t\t\tpanic(\"Invalid format parser state\")\n\t\t\t}\n\t\t}\n\t}\n\n\tif state != passThrough {\n\t\tswitch state {\n\t\tcase bracketOpen:\n\t\t\treturn \"\", fmt.Errorf(\"Unclosed brackets. The following format string is invalid: '%s'\", input)\n\n\t\tcase bracketClose:\n\t\t\treturn \"\", fmt.Errorf(\"Closing bracket without opening one. The following format string is invalid: '%s'\", input)\n\t\t}\n\t}\n\n\treturn output, nil\n}\n\nfunc (impl *interperterImpl) join(array reflect.Value, sep reflect.Value) (string, error) {\n\tseparator := impl.coerceToString(sep).String()\n\tswitch array.Kind() {\n\tcase reflect.Slice:\n\t\tvar items []string\n\t\tfor i := 0; i < array.Len(); i++ {\n\t\t\titems = append(items, impl.coerceToString(array.Index(i).Elem()).String())\n\t\t}\n\n\t\treturn strings.Join(items, separator), nil\n\tdefault:\n\t\treturn strings.Join([]string{impl.coerceToString(array).String()}, separator), nil","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/nektos/act/blob/4f411281417e88660bea1c1a1749aa71ae0bd60f/pkg/exprparser/functions.go#L115-L151","documentation":"Thrown by format() when a '}' is encountered with no preceding unescaped '{' (state bracketClose at end of input). A lone closing brace cannot be part of a placeholder and was not escaped.","triggerScenarios":"format('Hello 0}') or format('}') — closing brace without opening; escaping opening brace but not closing one ('{{' followed by single '}').","commonSituations":"Asymmetric brace escaping in templates; writing regular expressions or code snippets inside format() arguments.","solutions":["Escape the literal closing brace as '}}'.","Balance every placeholder's { and }.","Move regex/code text out of the format string into the arguments."],"exampleFix":"# before\n${{ format('json = {0}}', j) }}\n# after\n${{ format('json = {0}', j) }}","handlingStrategy":"validation","validationCode":"// same balancedBraces check as for unclosed brackets: a negative depth\n// detects a closing brace with no opener\nfunc noStrayCloseBrace(tpl string) bool { return balancedBraces(tpl) }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Escape literal } as }}","Keep placeholder braces paired on one line","Test templates in a scratch workflow before production"],"tags":["expressions","format-function","workflow-yaml","unbalanced-braces"],"backgroundTag":null,"analyzedSha":"4f411281417e88660bea1c1a1749aa71ae0bd60f","analyzedAt":"2026-08-15T09:19:46.307Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}