### Godot version

4.2 fa1fb2a

### System information

Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1060 (NVIDIA; 30.0.15.1403) - Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 Threads)

### Issue description

I have a scene that has a dependency on a tres resource (doesn't matter type). You can't open it, there is parse error. In this case:
```
Cannot open file 'res://new_gradient_texture_2d.tres'.
Failed loading resource: res://new_gradient_texture_2d.tres. Make sure resources have been imported by opening the project in the editor at least once.
C:\godot_source\scene/resources/resource_format_text.cpp:284 - res://s.tscn:6 - Parse Error: 
Failed loading resource: res://s.tscn. Make sure resources have been imported by opening the project in the editor at least once.
C:\godot_source\editor/editor_data.cpp:626 - Index p_idx = 1 is out of bounds (edited_scene.size() = 1).
```
A missing dependencies prompt shows normally, but pressing "Open Anyway" will just print the same errors and fail again. If an importable resource is missing (e.g. icon.svg), the scene will open normally.

### Steps to reproduce

1. Create scene
2. Add any text-based resource to it (GradientTexture for example)
3. Close the scene
4. Delete resource
5. Try to open the scene

### Minimal reproduction project

[s.tscn.txt](https://github.com/godotengine/godot/files/13419197/s.tscn.txt)

}
		} else if (id == "Object") {
			get_token(p_stream, token, line, r_err_str);
			if (token.type != TK_PARENTHESIS_OPEN) {
				r_err_str = "Expected '('";
				return ERR_PARSE_ERROR;
			}
			get_token(p_stream, token, line, r_err_str);
			if (token.type != TK_IDENTIFIER) {
				r_err_str = "Expected identifier with type of object";
				return ERR_PARSE_ERROR;
			}
			String type = token.value;
			Object *obj = ClassDB::instantiate(type);
			if (!obj) {
				r_err_str = "Can't instantiate Object() of type: " + type;
				return ERR_PARSE_ERROR;
			}
			Ref<RefCounted> ref = Ref<RefCounted>(Object::cast_to<RefCounted>(obj));
			get_token(p_stream, token, line, r_err_str);
			if (token.type != TK_COMMA) {
				r_err_str = "Expected ',' after object type";
				return ERR_PARSE_ERROR;
			}
			bool at_key = true;
			String key;
			bool need_comma = false;
			while (true) {
				if (p_stream->is_eof()) {
					r_err_str = "Unexpected End of File while parsing Object()";