Diagnostics

abstract_class

Objects can’t be created from abstract classes. Abstract classes are used as base classes for other classes, but they don’t have functionality on their own. You may want to use a non-abstract subclass instead.

bad_syntax

The tokenizer encountered an unexpected sequence of characters that aren’t part of any known blueprint syntax.

child_not_accepted

The parent class does not have child objects (it does not implement Gtk.Buildable and is not a subclass of Gio.ListStore). Some classes use properties instead of children to add widgets. Check the parent class’s documentation.

conversion_error

The value’s type cannot be converted to the target type.

Subclasses may be converted to their superclasses, but not vice versa. A type that implements an interface can be converted to that interface’s type. Many boxed types can be parsed from strings in a type-specific way.

expected_bool

A boolean value was expected, but the value is not true or false.

extension_not_repeatable

This extension can’t be used more than once in an object.

extension_wrong_parent_type

No extension with the given name exists for this object’s class (or, for a child extension, the parent class).

invalid_number_literal

The tokenizer encountered what it thought was a number, but it couldn’t parse it as a number.

member_dne

The value is being interpreted as a member of an enum or flag type, but that type doesn’t have a member with the given name.

missing_gtk_declaration

All blueprint files must start with a GTK declaration, e.g. using Gtk 4.0;.

multiple_templates

Only one template is allowed per blueprint file, but there are multiple. The template keyword indicates which object is the one being instantiated.

namespace_not_found

The .typelib files for the given namespace could not be found. There are several possibilities:

  • There is a typo in the namespace name, e.g. Adwaita instead of Adw

  • The version number is incorrect, e.g. Adw 1.0 instead of Adw 1. The library’s documentation will tell you the correct version number to use.

  • The packages for the library are not installed. On some distributions, the .typelib file is in a separate package from the main library, such as a -devel package.

  • There is an issue with the path to the typelib file. The GI_TYPELIB_PATH environment variable can be used to add additional paths to search.

namespace_not_imported

The given namespace was not imported at the top of the file. Importing the namespace is necessary because it tells blueprint-compiler which version of the library to use.

object_dne

No object with the given ID exists in the current scope.

property_dne

The class or interface doesn’t have a property with the given name.

property_convert_error

The value given for the property can’t be converted to the property’s type.

property_construct_only

The property can’t be bound because it is a construct-only property, meaning it can only be set once when the object is first constructed. Binding it to an expression could cause its value to change later.

property_read_only

This property can’t be set because it is marked as read-only.

signal_dne

The class or interface doesn’t have a signal with the given name.

type_dne

The given type doesn’t exist in the namespace.

type_not_a_class

The given type exists in the namespace, but it isn’t a class. An object’s type must be a concrete (not abstract) class, not an interface or boxed type.

version_conflict

This error occurs when two versions of a namespace are imported (possibly transitively) in the same file. For example, this will cause a version conflict:

using Gtk 4.0;
using Gtk 3.0;

But so will this:

using Gtk 4.0;
using Handy 1;

because libhandy imports Gtk 3.0.

wrong_compiler_version

This version of blueprint-compiler is for GTK 4 blueprints only. Future GTK versions will use different versions of blueprint-compiler.

Linter Rules

adjustment_prop_order

An Adjustment’s value property must be set after the lower and upper properties. Otherwise, it will be clamped to 0 when it is set, since that is the default lower and upper bounds of the Adjustment.

avoid_all_caps

According to the GNOME Human Interface Guidelines, labels should not use all capital letters.

gtk_switch_state

The state property controls the backend state of the switch directly. In most cases, you want to use active, unless you are using the delayed state change feature described in state-set.

missing_descriptive_text

This widget has no text that would describe its purpose to a screen reader or other accessibility software. You should add a tooltip, or an accessibilty block:

Image {
  accessibility {
    description: _("A cat jumping into a box");
  }
}

If the widget is purely decorative, you can set the presentation accessibility role to hide it from accessibility software:

Image {
  accessible-role: presentation;
}

missing_user_facing_text

This widget should have some text to display to the user to describe its function, such as a label or tooltip, but it doesn’t.

number_of_children

Some widgets can only have one child, and some cannot have any. Check the documentation for the widget you are using.

scrollable_parent

A widget that implements Scrollable should be a child of a ScrolledWindow or a Adw.ClampScrollable. Otherwise, it may not work correctly.

In particular, this setup with an Adw.Clamp is incorrect:

ScrolledWindow {
  Adw.Clamp {
    ListView {}
  }
}

because the ListView’s direct parent needs to provide scrolling for it. Adw.ClampScrollable exists for this purpose:

ScrolledWindow {
  Adw.ClampScrollable {
    ListView {}
  }
}

translate_display_string

This property should usually be marked as translated.

unused_widget

This top-level widget has no ID, so it can’t be referenced elsewhere in the blueprint or the application.

Note

Technically, it could be referenced in the application, since you can call Gtk.Builder.get_objects() to get all objects in the blueprint. However, this is not recommended, since it could break easily if you change the blueprint.

use_adw_bin

When using libadwaita, it is preferable to use Adw.Bin for a container that only has one child, rather than a Box, since Bin is specifically designed for this case.

use_styles

The Widget:css-classes property allows you to set the widget’s CSS classes in an array. However, doing so overwrites any default classes the widget may set, which could make the styling look broken. Use the styles block instead, since it adds the classes to the existing list.

use_unicode

The text in a translated string should use Unicode characters where appropriate, such as “smart quotes” GNOME Human Interface Guidelines.

wrong_parent

Some object classes only have meaning inside a particular parent class. For example, a StackPage is a child of a Stack and will not work elsewhere.

visible_true

In GTK 3, widgets were not visible by default, so you had to set visible: true on each one. However, in GTK 4, the visible <https://docs.gtk.org/gtk4/property.Widget.visible.html> property defaults to true, so this is no longer necessary.