{"record":{"id":"3ff97f3a2369bffd","repo":"owasp-amass/amass","slug":"error-when-splitting-the-key-w","errorCode":null,"errorMessage":"error when splitting the key: %w","messagePattern":"error when splitting the key: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/transform.go","lineNumber":52,"sourceCode":"// loadTransformSettings processes the Transformations map from the configuration,\n// assigning structured data to each Transformation based on its key.\n// Each key is parsed into 'From' and 'To' segments, representing the origin and target\n// of the transformation, respectively, which are then stored in the corresponding Transformation struct.\nfunc (c *Config) loadTransformSettings(cfg *Config) error {\n\t// Retrieve the global options from the Options, if it's set.\n\tif err := c.loadGlobalTransformSettings(); err != nil {\n\t\treturn err\n\t}\n\t// Iterate through each transformation rule defined in the configuration.\n\tfor key, transformation := range c.Transformations {\n\t\t// Initialize transformation if nil\n\t\tif transformation == nil {\n\t\t\ttransformation = &Transformation{}      // default struct\n\t\t\tc.Transformations[key] = transformation // assign it back to the map\n\t\t}\n\t\t// Spit the key into 'From' and 'To' components.\n\t\tif err := transformation.Split(key); err != nil {\n\t\t\treturn fmt.Errorf(\"error when splitting the key: %w\", err)\n\t\t}\n\t\t// Apply the global confidence if no specific confidence is set for this transformation.\n\t\tif transformation.Confidence == 0 {\n\t\t\ttransformation.Confidence = c.DefaultTransformations.Confidence\n\t\t}\n\t\tif transformation.TTL == 0 {\n\t\t\ttransformation.TTL = c.DefaultTransformations.TTL\n\t\t}\n\n\t\terr := transformation.Validate(c)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t// If the loop completes with no conflicts, the function returns nil, indicating success.\n\treturn nil\n}\n","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/owasp-amass/amass/blob/79299dce87b0085db0f2f4ef3e9c52cccb49f514/config/transform.go#L34-L70","documentation":"loadTransformSettings reads each key of the config's 'transformations' map and asks Transformation.Split to parse it as 'from->to'. When Split fails, this error wraps the underlying reason (e.g. invalid key delimiter). It means a transformation key in your config does not follow the required 'From->To' format.","triggerScenarios":"Config YAML containing a transformations entry keyed by anything other than exactly one '->' separated pair, e.g. 'a>b' or 'a->b->c', loaded via prepareConfig/Config loading.","commonSituations":"Hand-written transformation sections in amass config YAML, using '=>' or ':' instead of '->', or chaining multiple hops in a single key.","solutions":["Rewrite the transformation key using the '->' delimiter exactly once: 'from->to'","Split multi-hop transformations into separate single-hop entries","Validate key format with strings.Count(key, \"-\") == 1 before loading"],"exampleFix":"// before\ntransformations:\n  subdomain:ip: {}\n// after\ntransformations:\n  subdomain->ip: {}","handlingStrategy":"try-catch","validationCode":"for key := range transformationsRaw {\n\tif strings.Count(key, \"->\") != 1 {\n\t\treturn fmt.Errorf(\"transformation key %q must be 'from->to'\", key)\n\t}\n}","typeGuard":null,"tryCatchPattern":"if err := cfg.LoadSettings(path); err != nil {\n\tif strings.Contains(err.Error(), \"error when splitting the key\") {\n\t\treturn fmt.Errorf(\"config has malformed transformation keys: %w\", err)\n\t}\n\treturn err\n}","preventionTips":["Use exactly '->' as the transformation key delimiter","Keep one hop per transformation entry","Validate transformation keys when generating config YAML"],"tags":["config","yaml","transformations","amass"],"backgroundTag":"invalid-config-value","analyzedSha":"79299dce87b0085db0f2f4ef3e9c52cccb49f514","analyzedAt":"2026-09-06T08:22:48.198Z","contentChangedAt":"2026-09-06T08:22:48.198Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}