fyne-io/fyne · error

TODO only know how to handle DataIntDec type here

Error message

TODO only know how to handle DataIntDec type here

What it means

In addAttributeNamespace, when a resolved attribute type spec has exactly one value, the encoder assumes that value is stored as DataIntDec (decimal integer) and then reinterprets the integer itself as a DataType tag (string/bool/etc.). If the single value has any other storage type (string, hex, float), there is no code path for it and the function panics with this TODO.

Source

Thrown at cmd/fyne/internal/mobile/binres/binres.go:668

// If the value was not already present in pool, it is added.
func addAttributeNamespace(attr xml.Attr, nattr *Attribute, tbl *Table, pool *Pool) error {
	// get type spec and value data type
	ref, err := tbl.RefByName("attr/" + attr.Name.Local)
	if err != nil {
		return err
	}
	nt, err := ref.Resolve(tbl)
	if err != nil {
		return err
	}
	if len(nt.values) == 0 {
		panic("encountered empty values slice")
	}

	if len(nt.values) == 1 {
		val := nt.values[0]
		if val.data.Type != DataIntDec {
			panic("TODO only know how to handle DataIntDec type here")
		}

		t := DataType(val.data.Value)
		switch t {
		case DataString, DataAttribute, DataType(0x3e):
			// TODO identify 0x3e, in bootstrap.xml this is the native lib name
			nattr.RawValue = pool.ref(attr.Value)
			nattr.TypedValue.Type = DataString
			nattr.TypedValue.Value = uint32(nattr.RawValue)
		case DataIntBool, DataType(0x08):
			nattr.TypedValue.Type = DataIntBool
			switch attr.Value {
			case "true":
				nattr.TypedValue.Value = 0xFFFFFFFF
			case "false":
				nattr.TypedValue.Value = 0
			default:
				return fmt.Errorf("invalid bool value %q", attr.Value)

View on GitHub (pinned to 8860ee95c3)

Solutions

  1. Remove the recently added attribute from the custom manifest (bisect to identify it)
  2. Update fyne to a version whose vendored tables encode the attribute as DataIntDec
  3. Patch addAttributeNamespace to handle the additional data type and contribute the fix upstream
Defensive patterns

Strategy: validation

Validate before calling

// Pre-flight: diff your custom manifest attributes against a known-good baseline
// (attributes encoded successfully by your current fyne version).
func checkAttrs(custom, baseline []string) error {
    known := map[string]bool{}
    for _, a := range baseline { known[a] = true }
    for _, a := range custom {
        if !known[a] { return fmt.Errorf("unvetted manifest attribute %q may not be encodable", a) }
    }
    return nil
}

Prevention

When it happens

Trigger: A manifest attribute whose framework type spec contains exactly one value typed as something other than DataIntDec - an attribute whose format definition is stored as a string in the vendored tables - during 'fyne package -os android'.

Common situations: Same class as the empty-values panic: newer or unusual android: attributes; vendored framework data lagging the SDK; fyne versions behind current Android releases.

Related errors


AI-assisted analysis of fyne-io/fyne@8860ee95c3 (2026-08-15). Data as JSON: /api/errors/fee14ddca640ae4a. Report an issue: GitHub.