# Source: https://mikro-orm.io/api/core/class/NonUniqueFieldNameException.md

# NonUniqueFieldNameException<!-- -->

Exception for a non-unique/ambiguous specified field name in a statement detected in the driver.

### Hierarchy

* [ServerException](https://mikro-orm.io/api/core/class/ServerException.md)
  * *NonUniqueFieldNameException*

## Index[**](#Index)

### Constructors

* [**constructor](#constructor)

### Properties

* [**cause](#cause)
* [**code](#code)
* [**errmsg](#errmsg)
* [**errno](#errno)
* [**message](#message)
* [**name](#name)
* [**sqlMessage](#sqlMessage)
* [**sqlState](#sqlState)
* [**stack](#stack)
* [**stackTraceLimit](#stackTraceLimit)

### Methods

* [**captureStackTrace](#captureStackTrace)
* [**prepareStackTrace](#prepareStackTrace)

## Constructors<!-- -->[**](#Constructors)

### [**](#constructor)[**](https://github.com/mikro-orm/mikro-orm/blob/master/packages/core/src/exceptions.ts#L14)constructor

* ****new NonUniqueFieldNameException**(previous): [NonUniqueFieldNameException](https://mikro-orm.io/api/core/class/NonUniqueFieldNameException.md)

- Inherited from ServerException.constructor

  #### Parameters

  * ##### previous: Error

  #### Returns [NonUniqueFieldNameException](https://mikro-orm.io/api/core/class/NonUniqueFieldNameException.md)

## Properties<!-- -->[**](#Properties)

### [**](#cause)[**](https://undefined/mikro-orm/mikro-orm/blob/master/docs/node_modules/typescript/src/lib.es2022.error.d.ts#L26)optionalinheritedcause

**cause?

<!-- -->

: unknown

Inherited from ServerException.cause

### [**](#code)[**](https://github.com/mikro-orm/mikro-orm/blob/master/packages/core/src/exceptions.ts#L8)optionalinheritedcode

**code?

<!-- -->

: string

Inherited from ServerException.code

### [**](#errmsg)[**](https://github.com/mikro-orm/mikro-orm/blob/master/packages/core/src/exceptions.ts#L12)optionalinheritederrmsg

**errmsg?

<!-- -->

: string

Inherited from ServerException.errmsg

### [**](#errno)[**](https://github.com/mikro-orm/mikro-orm/blob/master/packages/core/src/exceptions.ts#L9)optionalinheritederrno

**errno?

<!-- -->

: number

Inherited from ServerException.errno

### [**](#message)[**](https://undefined/mikro-orm/mikro-orm/blob/master/docs/node_modules/typescript/src/lib.es5.d.ts#L1077)inheritedmessage

**message: string

Inherited from ServerException.message

### [**](#name)[**](https://undefined/mikro-orm/mikro-orm/blob/master/docs/node_modules/typescript/src/lib.es5.d.ts#L1076)inheritedname

**name: string

Inherited from ServerException.name

### [**](#sqlMessage)[**](https://github.com/mikro-orm/mikro-orm/blob/master/packages/core/src/exceptions.ts#L11)optionalinheritedsqlMessage

**sqlMessage?

<!-- -->

: string

Inherited from ServerException.sqlMessage

### [**](#sqlState)[**](https://github.com/mikro-orm/mikro-orm/blob/master/packages/core/src/exceptions.ts#L10)optionalinheritedsqlState

**sqlState?

<!-- -->

: string

Inherited from ServerException.sqlState

### [**](#stack)[**](https://undefined/mikro-orm/mikro-orm/blob/master/docs/node_modules/typescript/src/lib.es5.d.ts#L1078)optionalinheritedstack

**stack?

<!-- -->

: string

Inherited from ServerException.stack

### [**](#stackTraceLimit)[**](https://undefined/mikro-orm/mikro-orm/blob/master/node_modules/@types/node/globals.d.ts#L68)staticinheritedstackTraceLimit

**stackTraceLimit: number

Inherited from ServerException.stackTraceLimit

The `Error.stackTraceLimit` property specifies the number of stack frames collected by a stack trace (whether generated by `new Error().stack` or `Error.captureStackTrace(obj)`).

The default value is `10` but may be set to any valid JavaScript number. Changes will affect any stack trace captured *after* the value has been changed.

If set to a non-number value, or set to a negative number, stack traces will not capture any frames.

## Methods<!-- -->[**](#Methods)

### [**](#captureStackTrace)[**](https://undefined/mikro-orm/mikro-orm/blob/master/node_modules/@types/node/globals.d.ts#L52)staticinheritedcaptureStackTrace

* ****captureStackTrace**(targetObject, constructorOpt): void

- Inherited from ServerException.captureStackTrace

  Creates a `.stack` property on `targetObject`, which when accessed returns a string representing the location in the code at which `Error.captureStackTrace()` was called.

  ```
  const myObject = {};
  Error.captureStackTrace(myObject);
  myObject.stack;  // Similar to `new Error().stack`
  ```

  The first line of the trace will be prefixed with `${myObject.name}: ${myObject.message}`.

  The optional `constructorOpt` argument accepts a function. If given, all frames above `constructorOpt`, including `constructorOpt`, will be omitted from the generated stack trace.

  The `constructorOpt` argument is useful for hiding implementation details of error generation from the user. For instance:

  ```
  function a() {
    b();
  }

  function b() {
    c();
  }

  function c() {
    // Create an error without stack trace to avoid calculating the stack trace twice.
    const { stackTraceLimit } = Error;
    Error.stackTraceLimit = 0;
    const error = new Error();
    Error.stackTraceLimit = stackTraceLimit;

    // Capture the stack trace above function b
    Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
    throw error;
  }

  a();
  ```

  ***

  #### Parameters

  * ##### targetObject: object
  * ##### optionalconstructorOpt: Function

  #### Returns void

### [**](#prepareStackTrace)[**](https://undefined/mikro-orm/mikro-orm/blob/master/node_modules/@types/node/globals.d.ts#L56)staticinheritedprepareStackTrace

* ****prepareStackTrace**(err, stackTraces): any

- Inherited from ServerException.prepareStackTrace

  * **@see**

    <https://v8.dev/docs/stack-trace-api#customizing-stack-traces>

  ***

  #### Parameters

  * ##### err: Error
  * ##### stackTraces: CallSite\[]

  #### Returns any