owasp-amass/amass · warning

failed to obtain the TTL for transformation %s->%s

Error message

failed to obtain the TTL for transformation %s->%s

What it means

TTLStartTime computes when a transformation's cached data was last considered valid by consulting TTL matches for the from->to transformation pair. If no TTL match exists for that transformation, it returns this error along with a zero time.Time. The caller uses the result to build a time-travel cutoff for cached DB queries, so the error means the TTL configuration for this transformation edge is absent.

Source

Thrown at engine/plugins/support/support.go:111

}

func Shutdown() {
	close(done)
}

func TTLStartTime(c *config.Config, from, to, plugin string) (time.Time, error) {
	now := time.Now()

	if matches, err := c.CheckTransformations(from, to, plugin); err == nil && matches != nil {
		if ttl := matches.TTL(plugin); ttl >= 0 {
			return now.Add(time.Duration(-ttl) * time.Minute), nil
		}
		if ttl := matches.TTL(to); ttl >= 0 {
			return now.Add(time.Duration(-ttl) * time.Minute), nil
		}
	}

	return time.Time{}, fmt.Errorf("failed to obtain the TTL for transformation %s->%s", from, to)
}

func GetAPI(name string, e *et.Event) (string, error) {
	// TODO: Add support for multiple API keys
	dsc := e.Session.Config().GetDataSourceConfig(name)
	if dsc == nil || len(dsc.Creds) == 0 {
		return "", errors.New("no API key found")
	}

	for _, cred := range dsc.Creds {
		if cred != nil && cred.Apikey != "" {
			return cred.Apikey, nil
		}
	}

	return "", errors.New("no API key found")
}

View on GitHub (pinned to 79299dce87)

Solutions

  1. Add a TTL entry for the missing from->to transformation in the session/config TTL settings
  2. Verify the from and to transformation names exactly match those in the TTL configuration
  3. Log/print available TTL keys to confirm which transformations are configured
  4. Fall back to a sensible default (e.g. time.Time{} or a fixed window) in the caller when TTL is unconfigured
  5. Check that the config file providing TTLs was actually loaded (no silent config-load failure)

Example fix

// before
start, err := support.TTLStartTime(ctx, sess, event, from, to)
if err != nil {
    return fmt.Errorf("TTL error: %v", err)
}
// after
start, err := support.TTLStartTime(ctx, sess, event, from, to)
if err != nil {
    start = time.Time{} // no TTL configured: use full history
}
Defensive patterns

Strategy: fallback

Validate before calling

// Go: check the transformation has a TTL configured before calling
if sess.TTL(to) < 0 {
    // no TTL for this transformation: skip TTLStart or use zero time
    start = time.Time{}
} else {
    start, _ = support.TTLStartTime(ctx, sess, event, from, to)
}

Type guard

func isTTLNotConfigured(err error) bool {
    return err != nil && strings.Contains(err.Error(), "failed to obtain the TTL for transformation")
}

Try / catch

start, err := support.TTLStartTime(ctx, sess, event, from, to)
if err != nil {
    if isTTLNotConfigured(err) {
        start = time.Time{} // default: full history
    } else {
        return err
    }
}

Prevention

When it happens

Trigger: Calling TTLStartTime with a from/to transformation pair that has no entry in the event/session TTL matches; matches.TTL(to) returns a negative value (no configured TTL) for every candidate, so the function reaches the final return.

Common situations: Missing or incomplete transformation TTL configuration (e.g. no TTLs loaded from config for this edge); typo in the transformation names so they don't match configured TTL entries; a new transformation added without adding a corresponding TTL entry; running with a config that disables/omits TTLs entirely.

Understand the failure class

Background: "missing required config value" errors: why libraries refuse to start when a configuration key is empty, unset, or blank — this error's family across 48 libraries.

Related errors


AI-assisted analysis of owasp-amass/amass@79299dce87 (2026-09-06). Data as JSON: /api/errors/6f459788b5b67464. Report an issue: GitHub.