{"record":{"id":"941e886167703015","repo":"nektos/act","slug":"invalid-json-v","errorCode":null,"errorMessage":"Invalid JSON: %v","messagePattern":"Invalid JSON: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/exprparser/functions.go","lineNumber":177,"sourceCode":"\n\tjson, err := json.MarshalIndent(value.Interface(), \"\", \"  \")\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"Cannot convert value to JSON. Cause: %v\", err)\n\t}\n\n\treturn string(json), nil\n}\n\nfunc (impl *interperterImpl) fromJSON(value reflect.Value) (interface{}, error) {\n\tif value.Kind() != reflect.String {\n\t\treturn nil, fmt.Errorf(\"Cannot parse non-string type %v as JSON\", value.Kind())\n\t}\n\n\tvar data interface{}\n\n\terr := json.Unmarshal([]byte(value.String()), &data)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Invalid JSON: %v\", err)\n\t}\n\n\treturn data, nil\n}\n\nfunc (impl *interperterImpl) hashFiles(paths ...reflect.Value) (string, error) {\n\tvar ps []gitignore.Pattern\n\n\tconst cwdPrefix = \".\" + string(filepath.Separator)\n\tconst excludeCwdPrefix = \"!\" + cwdPrefix\n\tfor _, path := range paths {\n\t\tif path.Kind() == reflect.String {\n\t\t\tcleanPath := path.String()\n\t\t\tif strings.HasPrefix(cleanPath, cwdPrefix) {\n\t\t\t\tcleanPath = cleanPath[len(cwdPrefix):]\n\t\t\t} else if strings.HasPrefix(cleanPath, excludeCwdPrefix) {\n\t\t\t\tcleanPath = \"!\" + cleanPath[len(excludeCwdPrefix):]\n\t\t\t}","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/nektos/act/blob/4f411281417e88660bea1c1a1749aa71ae0bd60f/pkg/exprparser/functions.go#L159-L195","documentation":"Thrown by hashFiles() when one of its arguments is not a string. Every pattern argument must be a string literal or string-valued expression; arrays, booleans, or null are rejected before matching.","triggerScenarios":"hashFiles(inputs.patterns) where the input is an array/object; hashFiles(fromJSON('\"a\"') && true) style coercion mistakes; hashFiles() on a matrix value of non-string type.","commonSituations":"Trying to pass a list of patterns stored as JSON array directly; untyped inputs defaulting to non-string; copying patterns from a variable that is null.","solutions":["Pass each pattern as a separate string argument.","If patterns come as a JSON array, spread it first: hashFiles(fromJSON(patterns)[0], ...).","Ensure the referenced input/variable is a string type.","Use toJSON(...) to debug what the argument actually is."],"exampleFix":"# before\n${{ hashFiles(inputs.patternList) }}\n# after\n${{ hashFiles('**/*.go', '**/go.sum') }}","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"func allStringArgs(args []reflect.Value) bool {\n  for _, a := range args {\n    if a.Kind() != reflect.String { return false }\n  }\n  return true\n}","tryCatchPattern":null,"preventionTips":["Pass hashFiles only string literal patterns","Spread JSON arrays into individual string args","Debug argument types with toJSON before use"],"tags":["expressions","hash-files","type-mismatch","workflow-yaml"],"backgroundTag":null,"analyzedSha":"4f411281417e88660bea1c1a1749aa71ae0bd60f","analyzedAt":"2026-08-15T09:19:46.307Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}