Open History to see the last commit
1---
2id: debugging
3title: Debugging React Usage
4---
5β
6Here's a list of common errors you might see in the console and how to fix them.
7β
8## Changing an uncontrolled input to be controlled
9β
10If you see this error in the console:
11β
12```
13Warning: A component is changing an uncontrolled input to be controlled. This is likely caused by the value changing from undefined to a defined value, which should not happen. Decide between using a controlled or uncontrolled input element for the lifetime of the component. More info: https://reactjs.org/link/controlled-components
14```
15β
16It's likely you forgot the `defaultValues` in your `useForm` Hook or `form.Field` component usage. This is occurring
17because the input is being rendered before the form value is initialized and is therefore changing from `undefined` to `""` when a text input is made.
18β
19## Field value is of type `unknown`
20β
21If you're using `form.Field` and, upon inspecting the value of `field.state.value`, you see that the value of a field is of type `unknown`, it's likely that your form's type was too large for us to safely evaluate.
22β
23This typically is a sign that you should break down your form into smaller forms or use a more specific type for your form.
24β
25A workaround to this problem is to cast `field.state.value` using TypeScript's `as` keyword:
26β
27```tsx
28const value = field.state.value as string
29```
30β
31## `Type instantiation is excessively deep and possibly infinite`
32β
33If you see this error in the console when running `tsc`:
34β
35```
36Type instantiation is excessively deep and possibly infinite
37```
38β
39You've run into a bug that we didn't catch in our type definitions. While we've done our best to make sure our types are as accurate as possible, there are some edge cases where TypeScript struggled with the complexity of our types.
40β
41Please [report this issue to us on GitHub](https://github.com/TanStack/form/issues) so we can fix it. Just make sure to include a minimal reproduction so that we're able to help you debug.
42β
43> Keep in mind that this error is a TypeScript error and not a runtime error. This means that your code will still run on the user's machine as expected.