I am not sure what changed (Possibly due to an update of hyprland?), but when I try to use grim I receive the following errors:
$ grim
[destroyed object]: error 0: Format invalid
failed to screenshoot all outputs
$ WAYLAND_DEBUG=1 grim
[3083147.571] {Default Queue} -> wl_display#1.get_registry(new id wl_registry#2)
[3083147.587] {Default Queue} -> wl_display#1.sync(new id wl_callback#3)
[3083147.947] {Display Queue} wl_display#1.delete_id(3)
[3083147.969] {Default Queue} wl_registry#2.global(1, "wl_seat", 9)
[3083147.978] {Default Queue} wl_registry#2.global(2, "wl_data_device_manager", 3)
[3083147.982] {Default Queue} wl_registry#2.global(3, "wl_compositor", 6)
[3083147.986] {Default Queue} wl_registry#2.global(4, "wl_subcompositor", 1)
[3083147.989] {Default Queue} wl_registry#2.global(5, "wl_shm", 1)
[3083147.995] {Default Queue} -> wl_registry#2.bind(5, "wl_shm", 1, new id [unknown]#4)
[3083148.001] {Default Queue} wl_registry#2.global(6, "wp_viewporter", 1)
[3083148.006] {Default Queue} wl_registry#2.global(7, "wp_tearing_control_manager_v1", 1)
[3083148.009] {Default Queue} wl_registry#2.global(8, "wp_fractional_scale_manager_v1", 1)
[3083148.012] {Default Queue} wl_registry#2.global(9, "zxdg_output_manager_v1", 3)
[3083148.016] {Default Queue} -> wl_registry#2.bind(9, "zxdg_output_manager_v1", 2, new id [unknown]#5)
[3083148.021] {Default Queue} wl_registry#2.global(10, "wp_cursor_shape_manager_v1", 1)
[3083148.025] {Default Queue} wl_registry#2.global(11, "zwp_idle_inhibit_manager_v1", 1)
[3083148.029] {Default Queue} wl_registry#2.global(12, "zwp_relative_pointer_manager_v1", 1)
[3083148.032] {Default Queue} wl_registry#2.global(13, "zxdg_decoration_manager_v1", 1)
[3083148.036] {Default Queue} wl_registry#2.global(14, "wp_alpha_modifier_v1", 1)
[3083148.040] {Default Queue} wl_registry#2.global(15, "zwlr_gamma_control_manager_v1", 1)
[3083148.044] {Default Queue} wl_registry#2.global(16, "ext_foreign_toplevel_list_v1", 1)
[3083148.048] {Default Queue} wl_registry#2.global(17, "zwp_pointer_gestures_v1", 3)
[3083148.051] {Default Queue} wl_registry#2.global(18, "zwlr_foreign_toplevel_manager_v1", 3)
[3083148.057] {Default Queue} wl_registry#2.global(19, "zwp_keyboard_shortcuts_inhibit_manager_v1", 1)
[3083148.062] {Default Queue} wl_registry#2.global(20, "zwp_text_input_manager_v1", 1)
[3083148.066] {Default Queue} wl_registry#2.global(21, "zwp_text_input_manager_v3", 1)
[3083148.071] {Default Queue} wl_registry#2.global(22, "zwp_pointer_constraints_v1", 1)
[3083148.076] {Default Queue} wl_registry#2.global(23, "zwlr_output_power_manager_v1", 1)
[3083148.080] {Default Queue} wl_registry#2.global(24, "xdg_activation_v1", 1)
[3083148.084] {Default Queue} wl_registry#2.global(25, "ext_idle_notifier_v1", 1)
[3083148.089] {Default Queue} wl_registry#2.global(26, "ext_session_lock_manager_v1", 1)
[3083148.094] {Default Queue} wl_registry#2.global(27, "zwp_input_method_manager_v2", 1)
[3083148.098] {Default Queue} wl_registry#2.global(28, "zwp_virtual_keyboard_manager_v1", 1)
[3083148.103] {Default Queue} wl_registry#2.global(29, "zwlr_virtual_pointer_manager_v1", 2)
[3083148.108] {Default Queue} wl_registry#2.global(30, "zwlr_output_manager_v1", 4)
[3083148.112] {Default Queue} wl_registry#2.global(31, "org_kde_kwin_server_decoration_manager", 1)
[3083148.117] {Default Queue} wl_registry#2.global(32, "hyprland_focus_grab_manager_v1", 1)
[3083148.122] {Default Queue} wl_registry#2.global(33, "zwp_tablet_manager_v2", 1)
[3083148.125] {Default Queue} wl_registry#2.global(34, "zwlr_layer_shell_v1", 5)
[3083148.130] {Default Queue} wl_registry#2.global(35, "wp_presentation", 1)
[3083148.134] {Default Queue} wl_registry#2.global(36, "xdg_wm_base", 6)
[3083148.142] {Default Queue} wl_registry#2.global(37, "zwlr_data_control_manager_v1", 2)
[3083148.148] {Default Queue} wl_registry#2.global(38, "zwp_primary_selection_device_manager_v1", 1)
[3083148.152] {Default Queue} wl_registry#2.global(39, "xwayland_shell_v1", 1)
[3083148.156] {Default Queue} wl_registry#2.global(40, "zwlr_screencopy_manager_v1", 3)
[3083148.162] {Default Queue} -> wl_registry#2.bind(40, "zwlr_screencopy_manager_v1", 1, new id [unknown]#6)
[3083148.168] {Default Queue} wl_registry#2.global(41, "hyprland_toplevel_export_manager_v1", 2)
[3083148.171] {Default Queue} wl_registry#2.global(42, "hyprland_global_shortcuts_manager_v1", 1)
[3083148.175] {Default Queue} wl_registry#2.global(43, "xdg_dialog_v1", 1)
[3083148.179] {Default Queue} wl_registry#2.global(44, "wp_drm_lease_device_v1", 1)
[3083148.185] {Default Queue} wl_registry#2.global(45, "wp_linux_drm_syncobj_manager_v1", 1)
[3083148.190] {Default Queue} wl_registry#2.global(46, "wl_drm", 2)
[3083148.194] {Default Queue} wl_registry#2.global(47, "zwp_linux_dmabuf_v1", 5)
[3083148.198] {Default Queue} wl_registry#2.global(48, "wl_output", 4)
[3083148.204] {Default Queue} -> wl_registry#2.bind(48, "wl_output", 3, new id [unknown]#7)
[3083148.210] {Default Queue} wl_registry#2.global(49, "wl_output", 4)
[3083148.215] {Default Queue} -> wl_registry#2.bind(49, "wl_output", 3, new id [unknown]#8)
[3083148.221] {Default Queue} wl_callback#3.done(78690)
[3083148.227] {Default Queue} -> zxdg_output_manager_v1#5.get_xdg_output(new id zxdg_output_v1#3, wl_output#8)
[3083148.234] {Default Queue} -> zxdg_output_manager_v1#5.get_xdg_output(new id zxdg_output_v1#9, wl_output#7)
[3083148.241] {Default Queue} -> wl_display#1.sync(new id wl_callback#10)
[3083148.486] {Display Queue} wl_display#1.delete_id(10)
[3083148.506] {Default Queue} discarded wl_shm#4.format(0)
[3083148.512] {Default Queue} discarded wl_shm#4.format(1)
[3083148.517] {Default Queue} discarded wl_shm#4.format(808669761)
[3083148.521] {Default Queue} discarded wl_shm#4.format(808669784)
[3083148.525] {Default Queue} discarded wl_shm#4.format(808665665)
[3083148.530] {Default Queue} discarded wl_shm#4.format(875708993)
[3083148.535] {Default Queue} discarded wl_shm#4.format(875709016)
[3083148.538] {Default Queue} wl_output#7.geometry(0, 0, 700, 390, 0, "Dell Inc.", "DELL U3219Q", 3)
[3083148.546] {Default Queue} wl_output#7.scale(1)
[3083148.552] {Default Queue} wl_output#7.mode(1, 3840, 2160, 59997)
[3083148.561] {Default Queue} wl_output#7.done()
[3083148.564] {Default Queue} wl_output#8.geometry(0, 0, 700, 390, 0, "Dell Inc.", "DELL U3219Q", 0)
[3083148.571] {Default Queue} wl_output#8.scale(1)
[3083148.574] {Default Queue} wl_output#8.mode(1, 3840, 2160, 59997)
[3083148.579] {Default Queue} wl_output#8.done()
[3083148.585] {Default Queue} zxdg_output_v1#3.name("DP-4")
[3083148.591] {Default Queue} zxdg_output_v1#3.description("Dell Inc. DELL U3219Q FVLH413 (DP-4)")
[3083148.596] {Default Queue} zxdg_output_v1#3.logical_position(0, 0)
[3083148.601] {Default Queue} zxdg_output_v1#3.logical_size(3840, 2160)
[3083148.606] {Default Queue} zxdg_output_v1#3.done()
[3083148.610] {Default Queue} zxdg_output_v1#9.name("DP-2")
[3083148.614] {Default Queue} zxdg_output_v1#9.description("Dell Inc. DELL U3219Q 21MH413 (DP-2)")
[3083148.619] {Default Queue} zxdg_output_v1#9.logical_position(-2160, -840)
[3083148.624] {Default Queue} zxdg_output_v1#9.logical_size(2160, 3840)
[3083148.629] {Default Queue} zxdg_output_v1#9.done()
[3083148.633] {Default Queue} wl_callback#10.done(78690)
[3083148.640] {Default Queue} -> zwlr_screencopy_manager_v1#6.capture_output(new id zwlr_screencopy_frame_v1#10, 0, wl_output#8)
[3083148.657] {Default Queue} -> zwlr_screencopy_manager_v1#6.capture_output(new id zwlr_screencopy_frame_v1#11, 0, wl_output#7)
[3083148.791] {Default Queue} zwlr_screencopy_frame_v1#10.buffer(808665688, 3840, 2160, 15360)
[3083148.845] {Default Queue} -> wl_shm#4.create_pool(new id wl_shm_pool#12, fd 5, 33177600)
[3083148.852] {Default Queue} -> wl_shm_pool#12.create_buffer(new id wl_buffer#13, 0, 3840, 2160, 15360, 808665688)
[3083148.860] {Default Queue} -> wl_shm_pool#12.destroy()
[3083148.867] {Default Queue} -> zwlr_screencopy_frame_v1#10.copy(wl_buffer#13)
[3083148.873] {Default Queue} zwlr_screencopy_frame_v1#11.buffer(808665688, 3840, 2160, 15360)
[3083148.891] {Default Queue} -> wl_shm#4.create_pool(new id wl_shm_pool#14, fd 6, 33177600)
[3083148.897] {Default Queue} -> wl_shm_pool#14.create_buffer(new id wl_buffer#15, 0, 3840, 2160, 15360, 808665688)
[3083148.903] {Default Queue} -> wl_shm_pool#14.destroy()
[3083148.908] {Default Queue} -> zwlr_screencopy_frame_v1#11.copy(wl_buffer#15)
[3083148.981] {Display Queue} wl_display#1.error(nil, 0, "Format invalid")
[destroyed object]: error 0: Format invalid
failed to screenshoot all outputs
Likely an hyprland bug.
Per the log, Hyprland gives a list of buffer formats that clients can use:
[3083148.506] {Default Queue} discarded wl_shm#4.format(0) [3083148.512] {Default Queue} discarded wl_shm#4.format(1) [3083148.517] {Default Queue} discarded wl_shm#4.format(808669761) [3083148.521] {Default Queue} discarded wl_shm#4.format(808669784) [3083148.525] {Default Queue} discarded wl_shm#4.format(808665665) [3083148.530] {Default Queue} discarded wl_shm#4.format(875708993) [3083148.535] {Default Queue} discarded wl_shm#4.format(875709016)
but then asks grim to receive the screenshot data in a format (808665688 = XBGR2101010, which grim supports) which is not in the list of allowed formats sent by Hyprland.
zwlr_screencopy_frame_v1#10.buffer(808665688, 3840, 2160, 15360)
Creating a buffer in this format fails.
[3083148.897] {Default Queue} -> wl_shm_pool#14.create_buffer(new id wl_buffer#15, 0, 3840, 2160, 15360, 808665688) ... [3083148.981] {Display Queue} wl_display#1.error(nil, 0, "Format invalid")