gastownhall/beads · error

dependency created_by is empty for %s -> %s

Error message

dependency created_by is empty for %s -> %s

What it means

Every legacy dependency row must record who created it (created_by), but this row's created_by column is empty. The reader enforces non-empty created_by because the current schema and audit features rely on dependency provenance; an edge without an author cannot be faithfully imported.

Source

Thrown at internal/migration/legacysqlite/reader.go:901

	}
	if err := checkUTF8(
		currentString{"dependency issue_id", id},
		currentString{"dependency depends_on_id", to},
		currentString{"dependency type", typ},
		currentString{"dependency created_by", by},
	); err != nil {
		return err
	}
	if err := checkCurrentVarchars(
		currentVarchar{"dependency issue_id", id, types.MaxFieldLen},
		currentVarchar{"dependency depends_on_id", to, types.MaxFieldLen},
		currentVarchar{"dependency type", typ, currentShortVarcharRunes},
		currentVarchar{"dependency created_by", by, types.MaxFieldLen},
	); err != nil {
		return err
	}
	if by == "" {
		return fmt.Errorf("dependency created_by is empty for %s -> %s", id, to)
	}
	issue := byID[id]
	if issue == nil || byID[to] == nil {
		return fmt.Errorf("orphan dependency %s -> %s", id, to)
	}
	if issue.Ephemeral != byID[to].Ephemeral {
		return fmt.Errorf("dependency %s -> %s crosses ephemeral storage", id, to)
	}
	key := id + "\x00" + to
	if seenDeps[key] {
		return fmt.Errorf("multiple legacy dependencies for %s -> %s", id, to)
	}
	seenDeps[key] = true
	created, e := parseTime(at)
	if e != nil {
		return e
	}
	if created.IsZero() {

View on GitHub (pinned to 71377f2769)

Solutions

  1. Backfill the empty created_by in the legacy DB with a known actor (e.g. the issue creator or a migration placeholder): UPDATE dependencies SET created_by = 'legacy-import' WHERE created_by = ''.
  2. If provenance truly is unknown and the edge is unimportant, DELETE the dependency row before migrating.
  3. Sweep for all empty values at once: SELECT issue_id, depends_on_id FROM dependencies WHERE created_by IS NULL OR created_by = ''.
  4. Then re-run the migration; ensure the placeholder value is a valid actor string within VARCHAR limits.

Example fix

// before: created_by = ''
UPDATE dependencies SET created_by = 'legacy-import' WHERE created_by = '' OR created_by IS NULL;
// after: every edge has provenance
Defensive patterns

Strategy: validation

Validate before calling

rows, err := legacyDB.Query(`SELECT issue_id, depends_on_id FROM dependencies WHERE created_by IS NULL OR created_by = ''`)
// backfill or delete these rows before migrating

Prevention

When it happens

Trigger: The legacy SQLite dependencies table has a row where created_by is '' (or NULL read as empty string) for the given issue_id -> depends_on_id pair, encountered in appendLegacyDependencyRow after UTF-8/VARCHAR validation passes.

Common situations: Very old bd versions that allowed anonymous dependency creation before created_by became mandatory; imports from other trackers that didn't track authors; manual INSERT INTO dependencies statements omitting created_by.

Understand the failure class

Background: "Missing required field" and "field is required" errors: why libraries reject payloads that omit mandatory fields — this error's family across 20 libraries.

Related errors


AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30). Data as JSON: /api/errors/92644899ac83d84a. Report an issue: GitHub.