{"record":{"id":"5c6a7b329584d3d8","repo":"projectdiscovery/nuclei","slug":"could-not-parse-profile-yaml-w","errorCode":null,"errorMessage":"could not parse profile YAML: %w","messagePattern":"could not parse profile YAML: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/nuclei/main.go","lineNumber":885,"sourceCode":"}\n\n// profileSecrets is a helper struct to extract secrets section from a template profile YAML\ntype profileSecrets struct {\n\tSecrets interface{} `yaml:\"secrets\"`\n}\n\n// processInlineSecretsFromProfile parses the profile YAML file for inline secrets\n// and creates a temporary secrets file compatible with nuclei's auth provider.\n// Returns the path to the temp file or empty string if no secrets found.\nfunc processInlineSecretsFromProfile(profilePath string, options *types.Options) (string, error) {\n\tdata, err := os.ReadFile(profilePath)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"could not read profile file: %w\", err)\n\t}\n\n\tvar profile profileSecrets\n\tif err := yaml.Unmarshal(data, &profile); err != nil {\n\t\treturn \"\", fmt.Errorf(\"could not parse profile YAML: %w\", err)\n\t}\n\n\tif profile.Secrets == nil {\n\t\treturn \"\", nil\n\t}\n\n\tsecretsData, err := yaml.Marshal(profile.Secrets)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"could not marshal inline secrets: %w\", err)\n\t}\n\n\ttempDir := filepath.Join(os.TempDir(), \"nuclei-secrets\")\n\tif err := os.MkdirAll(tempDir, 0700); err != nil {\n\t\treturn \"\", fmt.Errorf(\"could not create temp directory: %w\", err)\n\t}\n\n\ttempFile, err := os.CreateTemp(tempDir, \"inline-secrets-*.yaml\")\n\tif err != nil {","sourceCodeStart":867,"sourceCodeEnd":903,"githubUrl":"https://github.com/projectdiscovery/nuclei/blob/265b3a3dec374741614e342f813c10f8b38d2bb7/cmd/nuclei/main.go#L867-L903","documentation":"After reading, the profile YAML is unmarshaled into profileSecrets (cmd/nuclei/main.go:885); malformed YAML fails with 'could not parse profile YAML'. Only syntax validity matters at this stage — the secrets section is decoded loosely into interface{} — so this error indicates broken YAML (tab indentation, bad quoting, stray characters) rather than a semantically wrong secrets block. The wrapped %w error includes line/column from the decoder.","triggerScenarios":"A profile file with tab characters for indentation, unbalanced quotes/brackets, invalid escape sequences, or non-UTF8 bytes anywhere in the document.","commonSituations":"Hand-edited profiles pasted from docs where terminals inserted tabs; BOM or CRLF issues from Windows editors; partial rewrites truncating the file.","solutions":["Lint the file (`yamllint profile.yaml`) or expose hidden characters (`cat -A`)","Convert tabs to spaces and fix indentation of the whole document","Quick syntax check with any YAML parser before running nuclei","Regenerate the profile from a known-good template"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// cheap syntax pre-check with line numbers\nvar node yaml.Node\nif err := yaml.Unmarshal(raw, &node); err != nil {\n    return fmt.Errorf(\"profile YAML syntax error: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"var p profileSecrets\nif err := yaml.Unmarshal(data, &p); err != nil {\n    return fmt.Errorf(\"profile %s is malformed YAML (check tabs/indentation): %w\", path, err)\n}","preventionTips":["Lint profile files with yamllint before committing","Avoid tabs; use spaces consistently","cat -A to spot BOM/CRLF issues when profiles move between OSes"],"tags":["go","nuclei","yaml","configuration","profile"],"backgroundTag":null,"analyzedSha":"265b3a3dec374741614e342f813c10f8b38d2bb7","analyzedAt":"2026-08-15T20:05:51.855Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}