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


#1

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 ****...
* TCP_NODELAY set
* 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=127.0.0.1
< Expires: Thu, 01 Jan 1970 00:00:00 GMT
< Set-Cookie: c3tag=dev;Path=/;Domain=127.0.0.1
< Set-Cookie: c3canonical=false;Path=/;Domain=127.0.0.1
< 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">
  <type>
    <module>metadata</module>
    <name>C3Error</name>
  </type>
  <id>2122.23</id>
  <message>default value doesn't exist!</message>
  <codes>
    <k>0</k>
    <v>NotClassified</v>
  </codes>
* Connection #0 to host 127.0.0.1 left intact
</error>%

The stacktrace I get in Splunk is:

Failed, Target [engie-darwin/dev/ImportApi?action=imprt]] failed
c3.love.exceptions.C3RuntimeException: default value doesn't exist!
	at c3.love.C3.doesNotExistsError(C3.java:1484) ~[c3-love-7.8.1-SNAPSHOT.jar:na]
	at c3.love.C3.failIfMissing(C3.java:1478) ~[c3-love-7.8.1-SNAPSHOT.jar:na]
	at c3.love.C3.failIfMissing(C3.java:1473) ~[c3-love-7.8.1-SNAPSHOT.jar:na]
	at c3.love.util.Val.dflt(Val.java:47) ~[c3-love-7.8.1-SNAPSHOT.jar:na]
	at c3.engine.canonical.ImportApiMethods.imprt(ImportApiMethods.java:32) ~[c3-server-database-engine-7.8.1-SNAPSHOT.jar:na]
	at c3.type.dataload.methods.ImportApiMethodsBase$1.accept(ImportApiMethodsBase.java:39) ~[c3-love-7.8.1-SNAPSHOT.jar:na]
	at c3.type.dataload.methods.ImportApiMethodsBase$1.accept(ImportApiMethodsBase.java:37) ~[c3-love-7.8.1-SNAPSHOT.jar:na]
	at c3.server.engine.TypeSysEngine.execute(TypeSysEngine.java:65) ~[c3-server-server-7.8.1-SNAPSHOT.jar:na]
	at c3.server.impl.Task.doFilter(Task.java:242) ~[c3-server-server-7.8.1-SNAPSHOT.jar:na]
	at c3.server.impl.ServerDispatcherBase$ActionFilterChainImpl.doFilter(ServerDispatcherBase.java:193) ~[c3-server-server-7.8.1-SNAPSHOT.jar:na]
	at c3.server.envLogs.EnvLogListener.EnvLogListener.doFilter(EnvLogListener.java:75) ~[c3-server-server-7.8.1-SNAPSHOT.jar:na]
	at c3.server.impl.ServerDispatcherBase$ActionFilterChainImpl.doFilter(ServerDispatcherBase.java:191) ~[c3-server-server-7.8.1-SNAPSHOT.jar:na]
	at c3.server.impl.dataCache.DataCacheEngine.doFilter(DataCacheEngine.java:125) ~[c3-server-server-7.8.1-SNAPSHOT.jar:na]
	at c3.server.impl.ServerDispatcherBase$ActionFilterChainImpl.doFilter(ServerDispatcherBase.java:191) ~[c3-server-server-7.8.1-SNAPSHOT.jar:na]
	at c3.server.impl.ServerDispatcherBase.doFilter(ServerDispatcherBase.java:161) ~[c3-server-server-7.8.1-SNAPSHOT.jar:na]
	at c3.server.impl.InteractiveDispatcher.doFilter(InteractiveDispatcher.java:81) ~[c3-server-server-7.8.1-SNAPSHOT.jar:na]
	at c3.server.impl.Task.run(Task.java:178) ~[c3-server-server-7.8.1-SNAPSHOT.jar:na]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_131]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_131]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_131]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_131]
	at java.lang.Thread.run(Thread.java:748) [na:1.8.0_131]

The Toto.csv file is very simple and contains:

name;
FRMDA;

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


#2

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


#3

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.


#4

@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.


#5

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.