Error when importing file with CURL: default value doesn't exist!


I want to import data using CURL command, but I’m getting a 500 server error with the message “default value doesn’t exists”.
The curl command is:
curl -v -H "Content-Type: text/csv" -X PUT --data-binary @Toto.csv http://****/import/1/engie-darwin/dev/CanonicalToto/Toto.csv -u BA:**

*   Trying ****...
* Server auth using Basic with user 'BA'
> PUT /import/1/engie-darwin/dev/CanonicalToto/Toto.csv HTTP/1.1
> Authorization: Basic *********
> User-Agent: curl/7.54.0
> Accept: */*
> Content-Type: text/csv
> Content-Length: 19
* upload completely sent off: 19 out of 19 bytes
< HTTP/1.1 500 Server Error
< Date: Mon, 17 Sep 2018 13:12:38 GMT
< Set-Cookie: c3tenant=engie-darwin;Path=/;Domain=
< Expires: Thu, 01 Jan 1970 00:00:00 GMT
< Set-Cookie: c3tag=dev;Path=/;Domain=
< Set-Cookie: c3canonical=false;Path=/;Domain=
< X-C3-Tenant: engie-darwin
< X-C3-Tag: dev
< X-C3-Canonical: false
< Set-Cookie: c3auth=30331822eacedd467b370a0f1954bf418603f3ca49a1c50793d0277da951d7389c01;Path=/;HttpOnly
< X-Frame-Options: SAMEORIGIN
< Content-Type: application/xml; charset=UTF-8
< Access-Control-Allow-Origin: *
< X-Timing-Info: total=0.015693,cpu=0.010647,io=0.002917
< X-Action-Info: 8261.404630
< Vary: Accept-Encoding, User-Agent
< Transfer-Encoding: chunked
< Server: Jetty(9.4.9.v20180320)
<error version="2.0">
  <message>default value doesn't exist!</message>
* Connection #0 to host left intact

The stacktrace I get in Splunk is:

Failed, Target [engie-darwin/dev/ImportApi?action=imprt]] failed default value doesn't exist!
	at ~[c3-love-7.8.1-SNAPSHOT.jar:na]
	at ~[c3-love-7.8.1-SNAPSHOT.jar:na]
	at ~[c3-love-7.8.1-SNAPSHOT.jar:na]
	at ~[c3-love-7.8.1-SNAPSHOT.jar:na]
	at c3.engine.canonical.ImportApiMethods.imprt( ~[c3-server-database-engine-7.8.1-SNAPSHOT.jar:na]
	at c3.type.dataload.methods.ImportApiMethodsBase$1.accept( ~[c3-love-7.8.1-SNAPSHOT.jar:na]
	at c3.type.dataload.methods.ImportApiMethodsBase$1.accept( ~[c3-love-7.8.1-SNAPSHOT.jar:na]
	at c3.server.engine.TypeSysEngine.execute( ~[c3-server-server-7.8.1-SNAPSHOT.jar:na]
	at c3.server.impl.Task.doFilter( ~[c3-server-server-7.8.1-SNAPSHOT.jar:na]
	at c3.server.impl.ServerDispatcherBase$ActionFilterChainImpl.doFilter( ~[c3-server-server-7.8.1-SNAPSHOT.jar:na]
	at c3.server.envLogs.EnvLogListener.EnvLogListener.doFilter( ~[c3-server-server-7.8.1-SNAPSHOT.jar:na]
	at c3.server.impl.ServerDispatcherBase$ActionFilterChainImpl.doFilter( ~[c3-server-server-7.8.1-SNAPSHOT.jar:na]
	at c3.server.impl.dataCache.DataCacheEngine.doFilter( ~[c3-server-server-7.8.1-SNAPSHOT.jar:na]
	at c3.server.impl.ServerDispatcherBase$ActionFilterChainImpl.doFilter( ~[c3-server-server-7.8.1-SNAPSHOT.jar:na]
	at c3.server.impl.ServerDispatcherBase.doFilter( ~[c3-server-server-7.8.1-SNAPSHOT.jar:na]
	at c3.server.impl.InteractiveDispatcher.doFilter( ~[c3-server-server-7.8.1-SNAPSHOT.jar:na]
	at ~[c3-server-server-7.8.1-SNAPSHOT.jar:na]
	at java.util.concurrent.Executors$ [na:1.8.0_131]
	at [na:1.8.0_131]
	at java.util.concurrent.ThreadPoolExecutor.runWorker( [na:1.8.0_131]
	at java.util.concurrent.ThreadPoolExecutor$ [na:1.8.0_131]
	at [na:1.8.0_131]

The Toto.csv file is very simple and contains:


Toto type contains only a name string property.
The error I’m getting is happening on a server.
Any idea on what is the meaning of this error?


You probably have to add your canonical type to FileSourceCollection, check this


I retried with a corresponding FileSourceCollection but it does fix the error.
The case you mention is having a successful file upload. I don’t think it is the same case.


@NabilKoroghli The way to verify is to switch to engie-darwin dev and check if that FileSourceCollection exists for CanonicalToto. You can do this as below

FileSourceCollection.fetch({filter: "source == 'CanonicalToto'"}).objs 

when you curl to the import endpoint you need a FileSourceCollection for the source type configured on the tag.


Thanks @bachr and @garrynigel I was looking in the wrong tenant (c3). Indeed, when adding the FireSourceCollection the import goes further.
It would be great to have a more explicit error.